When I run app as test and then in Tulip player I noticed that application behaves differently.
Here is my step:
In this step user can select which Production line types are available for selected SKU. User selects line type from left table and presses Add selected which contains following trigger:
So triggers checks if combination of SKU and ProductionLineType already exists thru Query and Table Aggregtion (using count) and then creates new record.
On the right side user can remove ProductionLineType from SKU. This is done with click on a button Remove selected with trigger below:
When in test on Add selected click I have following behavior:
Already selected Production Line type:
Everything OK - trigger works when checking for existing selected line types.
If user select another Production Line type and clicks Add multiple times Query Aggregation always returns 0 count - multiple inserts from same Production line type
Remove selected trigger works:
In Tulip player adding same Production line type multiple times produces expected result:
Not allowing same Production Line Type multiple times.
But unfortunately Remove selected trigger produces following error (in test environment this trigger works well):
I have only this instance of app loaded in Tulip player.
What is the reason for different behaviors in test and Tulip player?
On a side note - workaround for checking if record exists based on table query and aggregated function is big issue for app development and “what should not be done” in any app which includes records stored in tables.
Tulip should consider adding custom unique constraints on tables (not only in Id column). This would prevent any inconsistency on data regardless of application (or manual correction in table itself).