I would like to add a constraint to check the number of selected orders equals 1 before running an action (if there is more than 1 my action causes SambaPos to crash).
I have tried:
I have also tried many other things(!) but cant get the right syntax for this to work. The rule and action works fine otherwise. Please can someone tell me the correct constraint to use. Thanks!
Not sure if the {SELECTED ORDERS COUNT} is valid. Try {SELECTED ORDER COUNT} please note without ‘S’.
Or use [=TN ('{SELECTED ORDERS}')] Greater 0. If more than 1 selected the value will contain comma separate value. It should return 0 when convert to number. Unless TN is too smart to get rid of it
Thanks for your replies. I have tried both variations and still cant get it working.
As I understand it {SELECTED ORDERS} will return a string of orders selected. What I need to know is how many there are selected (or if there is just one selected).
I have tried {SELECTED ORDER COUNT} which never fires the action so assuming it isnt a valid constraint
and [=TN (’{SELECTED ORDERS}’)] Greater 0 - this always fires the action even if I have 2 orders selected (and crashes the program).
Is there a list of valid constraints documented somewhere that I can look at?
Most {} tags are listed in printer template help.
What you want to do is add an ask question or show message action and for the question/message put in your {} expressions your testing so you can see what they are returning.
That’s what Ive just worked out and it is showing me that the {SELECTED ORDERS} is the only thing returning anything. If I select 2 orders this returns 2 numbers separated by a comma. So is there a way of counting commas - a string finding command?
You would probably need to +1 as a single selected order would have no comma and 2 only 1
Alternative would be to parse the list and use .length on the array created in scripts.