Sorry Klaus,
Few days of raining holidays make me understand where I was wrong.
I did this
Code: Select all
on mouseUp
set itemdel to TAB
put the dgText of group "listProd" into tList
put empty into tArray
repeat for each line i in tList
put item 1 of i into tContent
put item 2 of i into tKey
put tContent & tab after tArray[tKey]
end repeat
put tList into field "Fieldtext"
repeat for each key tKey2 in tArray
put tKey2 & CR after tNewList
end repeat
repeat with newL=1 to the number of lines of the keys of tArray
put empty into transList
put line newL of tNewlist into transList
put transList into fld ("qp" & newL)
end repeat
repeat with newP=1 to the number of lines of the keys of tArray
put fld ("qp" & newp) into valMulti
put empty into transprod
repeat for each key tkey3 in tArray
put tKey3 into valDyn
if valDyn mod valMulti =0 then put (tarray[tkey3] && X &&(valDyn / valMulti)) & cr & "--" & cr after transProd
put transProd into fld ("proP" & newP)
end repeat
end repeat
end mouseUp
I take datas from my datagrid "listProd", sort them by quantity, then by multiple and I add the factor.
It's a little start... but I'm very proud.
Now I'm going to enhance this backbone to optimise the code, first by function, then by adding other rules of sorting.
Thank you for your help and thank to jmburnot and jaque too.