Page 1 of 1


Posted: 07 Nov 2018, 09:42
by sideshowbond
I am looking for a way to store a group with the following conditions:
Store the group if it doesn't exist
Replace the group if it already exists

I tried

Code: Select all

to replace Group 999 but that didn't work. In fact it didn't store anything. There is an exception in the logs but that doesn't prove very helpful.

I can get delete, store and replace to work to build a workaround but that's not quite ideal the way I have that in mind.

Re: Group.StoreGroupReplace

Posted: 13 Nov 2018, 00:54
by Gregory
I don't think there is a single function which would do both replacing and storing as in most cases the software will return an error if it cannot do exactly what you have asked rather than make an assumption. What you would probably have to do is determine yourself whether the group already exists and then call the correct function, you should be able to do this using the Group.CheckIfGroupExists function.

Try this:

Code: Select all

<step>Group.CheckIfGroupExists(999.0, "Group.Numeric.IsValid")</step>
<step condition="Math.IsEqual(Group.Numeric.IsValid, True)">Group.ReplaceGroupOnHandle(userNumber:999)</step>
<step condition="Math.IsEqual(Group.Numeric.IsValid, False)">Group.StoreGroup(userNumber:999)</step>