Hi,
I want to populate a column called “First date” with the oldest date of all the rows with the same part number.
I have a table that has three columns: part number, PO date, First date. The table is sorted by part number.
I’m hoping someone can modify my code to make it work. I think I’m kind of close and this would really help me learn if I can follow the script.
SmPrt="False";
For(i=1,i<=nrows(),i+=1,
if(SmPrt="False",
FrstDt=PO date(i)
);
if(:Part number(i) == :part number(i-1),
SmPrt = "True", smPrt= "False"
);
if(SmPrt == "True",
if(:PO date(i)< :PO date(i-1),
FrstDt= :PO date(i)
)
);
if(smPrt = "False", :First date(i)=FrstDt);
);
If I understand correctly your issue, you may not need to use a script to achieve your goal.
Assuming that your "First Date" variable is numeric and continuous (not stored as text), you could use the Column Minimum formula with a "By" "Part Number" filter as shown below.
Col Minimum( :First Date, :Part Number )
Let me know if that meets your requirements.
Best,
TS