I am having trouble tackling a couple of things regarding the syntax of a rule for a calculated field as well as how to see the calculated value prior to saving.
I have an attribute (SortOrder) that allows the user to control how the order of specific related BO appears (an event is made up of a number workshops). When the user is entering a new workshop, I would like them to see the SortOrder as a defaulted as the max +1, but the rule I have written is giving me max + 1 sortorder for the entire entitty, not the event
IF Workshop IS NEW THEN Workshop.SortOrder = MAX Workshop.SortOrder +1
How do i get this to group on the Event so the sortorder is sequential for the event.
Also, when adding a new Workshop, I would like to the SortOrder rule to default the value so the user can see it prior to saving the record - there are cases where they will change on new/
Default Calculated Attribute
Hi Tom,
Yes - Workshops is owned by Events.
I did not convey the nature of the SortOrder field correctly - it is not marked as a calculated field although I used a rule to update. That provides me the ability to have the value set, and the ability on Edit to change it. I would prefer to "see" the rule apply during the add process and that way the user could make the proper adjustment if needed
thanks
Yes - Workshops is owned by Events.
I did not convey the nature of the SortOrder field correctly - it is not marked as a calculated field although I used a rule to update. That provides me the ability to have the value set, and the ability on Edit to change it. I would prefer to "see" the rule apply during the add process and that way the user could make the proper adjustment if needed
thanks
thom,
Try this:
1) Workshop rule:
If Workshop IS NEW Then
Workshop.SortOrder=MAX Workshop.SortOrder WHERE (Workshop.Entity=ThisWorkshop.Entity)+1
In the Advanced tab for this rule, check "Use rule during initialization"
2) Process named NewWorkshop:
CREATE Workshop WITH Workshop.Entity=Entity
EDIT Workshop USING Main
This rule will have Entity as a Process Input.
3) If you run process from #2 above when an Entity is in context (from an Entity form or Query, the SortOrder should default properly.
Try this:
1) Workshop rule:
If Workshop IS NEW Then
Workshop.SortOrder=MAX Workshop.SortOrder WHERE (Workshop.Entity=ThisWorkshop.Entity)+1
In the Advanced tab for this rule, check "Use rule during initialization"
2) Process named NewWorkshop:
CREATE Workshop WITH Workshop.Entity=Entity
EDIT Workshop USING Main
This rule will have Entity as a Process Input.
3) If you run process from #2 above when an Entity is in context (from an Entity form or Query, the SortOrder should default properly.
Tom - V8.8 build 3137 - MySql / PostGres
Tom,
I thought we had it, but I must be doing something wrong.
I updated the rule to include the where clause (which I previously tried but got nothing to return) and I check the "Use rule during Initialization " - thanks for that one, I never noticed the Advance tab before...obvious
My process was set as you recommended - upon adding a new workshop the SortOrder always defaults to 1 - whether it is the 1st or 20th workshop added for the event.
did i miss something? Thanks
thom
I thought we had it, but I must be doing something wrong.
I updated the rule to include the where clause (which I previously tried but got nothing to return) and I check the "Use rule during Initialization " - thanks for that one, I never noticed the Advance tab before...obvious
My process was set as you recommended - upon adding a new workshop the SortOrder always defaults to 1 - whether it is the 1st or 20th workshop added for the event.
did i miss something? Thanks
thom