DroplistBox: Cumulative total based on one quantity column and one code material column
Forums
Hi Brian
I've written a few larger scripts, they working as they should. Now I want to make them more user friendly by using dropdown.
I used some of the script found on the forum.
This scrip should calculate the cumulative quantity for each material code. In the drolistbox we selected the material code field and the quantity field:
Field amount will be used after the cumulative quantity.
The script creates the field CUMULATIVE_TOTAL but not calculate the cumulative quantity and returns this error:
I attach the code.
Could you help me?
Many thanks.
Hi Brian,
Hi Brian,
The field GIACENZA_PROGR is create with the function Create Field. I modified the script and i removed the functions "checkIfFieldNameExists". The error remain but the script create the field "GIACENZA_PROGR" but all the records are equal to 0.
I attach the new script version.
I'll be waiting for your advices.
Many thanks.
Paolo.
Hi Paolo,
Hi Paolo,
Is GIACENZA_PROGR actually a name of the field? If so you need it in quotes becuase on that line you are referencing a variable that contains nothing, if you want to use that field then you have two options.
1. is to add the fieldname to the variable such as: GIACENZA_PROGR = "GIACENZA_PROGR" and have this line after the Dim statements in the function or change the Set field = table.GetField(GIACENZA_PROGR) to Set field = table.GetField("GIACENZA_PROGR") so the function will look for that field name instead of what is contained within the variable.
Hope that helps out.
Brian
Hi Paolo,
Hi Paolo,
I was just able to run your script. I made two changes, one was to line 57 which is eqn = "0.00000", I needed to change the comma to a period but that is most likely because of my regional settings, probably not a problem for you. The other was on line 71 QTA= 0.00000 you had it within double quotes but as this is a double variable it should not be within quotes. I changed the comma to a period as I believe that items outside of the equation editor need to follow the English rules but I could be wrong, so you can try it with both a period or a comma. Here is what I got when I ran it on the Sample - Detailed Sales and selected these fields.
Hi Paolo,
Hi Paolo,
I will have a look and get back to you.
Brian