I am working on an app that is supposed to take a list of sizes and assign the sizes to small, medium, and large. I am having trouble filtering out the sizes in my if statements. If anyone knows what's wrong with my code, I would love the help. Here is a sample of my code:
It's impossible to debug this without seeing how sizelist gets loaded.
Export your .aia file and upload it here.
P.S. Can you rename Checkbox2 in the Designer to something more informative, like ckbFemale?
Thanks for the tip! Phone_App (1).aia (627.0 KB)
This looks like a case of write-only code, where the coder thinks he is done with the code after writing it, and does not go back to read it afterwards.
- Spinner1.Width is the width in pixels of the component, which is inappropriate for clothing sizes. You want Spinner1.Selection, same for all the other spinners.
- You did not need a list for this. Better to go into the Designer and rename those components, so you can use their names in the blocks:
if ckbMale.Checked then if (spnWaist.Selection <= 28) then set lblSize.Text to 'Small' else if (spnWaist.Selection <= 36) then set lblSize.Text to 'Medium' else set lblSize.Text to 'Large' end if
(Corrected - ABG)
I reorganize your if/then tree also, so that the Large assignment is included for Male customers only.
This is much more readable than list item counting, right?
P.P.S. When the the size comparisons are in numerical order, you can use that to simplify the range tests in an if/the/elseif tree.
Thank you! I really appreciate your help