Thanks for hint with arrow! drop down list looks inviting, but does not work
And thanks, this work now with your help.
This is a basic function that sets a key number to the ItemKeyNumber folder.
If key number was set already, it leaves it intact.
If it was not set, it makes it max+1.
This can be useful when you export your items somewhere, eg to excel, and want to have a specific key to identify items. For example if you make pivots and summarize costs by another columns, or draw graphs.
Code:function setnewkey()
curentvalue = 0 + ("0" .. get_folder_value("ItemKeyNumber",get_select_items()[1]) ) --- leave current value as is, or set it = 0, but not leave NULL.
if curentvalue ==0 then --- then set curentvalue = max+1
x = get_folder_items("ItemKeyNumber")
max=table.maxn(x)
m=0
for i=1,max do --- discover what is the max
m = math.max(m, get_folder_value("ItemKeyNumber",x[i]) )
end
set_folder_value("ItemKeyNumber",get_select_items()[1],m+1)
end
end