I posted the screenshots
You canāt natively. You cannot get a count of items that are part of a GroupCode unless you start storing some counts in Program Settings using the GroupCode as part of the Setting Name. Then you could check the Program Setting(s) in a Constraint.
As with everything āSambaPOSā there are multiple ways to achieve a desired result. Having a clear understanding of that result is key. I can show you some different ways, but as is most times the case, once I have done that, people will throw another piece of criteria in, which makes the solution break.
You can constrain Mappings, in particular, Print Job Mappings by Group, Product, and Product Tag.
You can Constrain Rules.
You can Constrain Actions with Rules.
You can make an Action āGenericā and then set the parameters of the Action via the Rule. Let me give you an exampleā¦ you have 3 Print Job Actions, that all do exactly the same thing, except the Print Job Name is different in each Rule.
So letās start there by making a Generic Execute Print Job Action ā¦
While weāre at it, letās make a Generic Update Program Setting Action we can use for whatever we like ā¦
The key to both of those Actions that makes them āgenericā is that we are using a [:variableName]
for some of the Action Parameters. That letās us set the Parameter via the Rule instead of hard-coding it in the Action itself.
Now when we put together a Rule, our Actions look like the following, where we can set the Action Parameter via the Rule into the [:variableName]
that we defined for each Action Parameter ā¦
Our Printing Rule looks similar, but now we have a single Action listed multiple times, and we have a [:variableName]
for the Print Job ([:printJobName]
). The point of this is show you the flexibility of using generic actions with variablesā¦
Is it going to work like we want? Donāt know, have not tested it. I donāt have your Groups, Jobs, or other Config Settings. Try it.
Before you ask, this is what you need to know if you donāt already ā¦
Could you not feed a list of order groupcodes from report expression into a script which checks the count?
It means add 1 to the Program Setting value for that particular Group Code, that is, increment the value/count for the Group Code Counter.
So when it counts the group , the setting value will be increased?
It is adding up the values of the Counters for 3 Group Codes to check if the Total is less than or equal to 1.
So I have to add all my groups?
I want to show the setting value for purpos, how to do that?
The sum of the three settings <= 1
But I dont think that is right,
This would mean 2 sandwiches only would print to grill.
All you want in these settings rather than a count of the number of orders for that group is if there are orders for that group, then if this sum >1
Is there any way to count the number of groupcode on the ticket?
How to do it? How to count groups?
I think we donāt need count of items. Instead of that , if we get count of groups contain on the order then check like count of groups>1 then print ??
How about this?
Sure, whatever you think will work. Fill yer boots.
How to get the number of groups?
Like I said, you canāt canāt the number Groups. Use a Report Tag as JTRTech suggested, or if you want to continue with what I posted, then this should work:
[=(TN('{SETTING:Counter_SANDWICHES}') > 0 ? 1: 0) + (TN('{SETTING:Counter_PASTRIES}') > 0 ? 1: 0) + (TN('{SETTING:Counter_GRILLS}') > 0 ? 1: 0)] <= 1
But again, I donāt know if any of that stuff I posted will work. The Counters might be empty (0
) for all I know. Maybe the Event Rule that is setting them does not have access to {GROUP CODE}
at all, in which case, none of it will work properly.
I think you solution is in Report Tags. Iām not expert on report but you should be able to get report total for each group separate by comma then use script .split(ā,ā).length should give total of group.