Action Constraint Help

its an add order action on a command executed rule. I want the rule to fire if a deposit amount has been added in [?prompt]

‘{ENTITY DATA:Birthday Party:Paid Deposit}’ > 0

it could even be

‘{ENTITY DATA:Birthday Party:Paid Deposit}’ != ‘0’ and I make it put the 0 in automatically…

But whatever it try it don’t work…

even [=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] != ‘0’

or

[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] > ‘0’

or

[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] > 0

or

[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] != ‘’

doesn’t work…

I’m out of ideas…

‘{ENTITY DATA:Birthday Party:Paid Deposit}’ > 0
[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] != ‘0’
[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] > ‘0’
[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] != ‘’
is never be True I guess because one side is text the other one is number.

‘{ENTITY DATA:Birthday Party:Paid Deposit}’ != ‘0’ This one should fired if NOT 0 in Paid Deposit field.

[=TN(’{ENTITY DATA:Birthday Party:Paid Deposit}’)] > 0 This one should fired if Paid Deposit field > 0.

2 Likes

but they don’t work… so something isn’t right :frowning:

Il look tomorrow now, its very late.

Can you put xx{ENTITY DATA:Birthday Party:Paid Deposit}xx in show message

2 Likes

yep I put in 60 into the prompt and it fired 60 back in message

Its odd

You can’t put ?Prompt in the same rule. Constraint will not work.

1 Like

since V5 it does. My other constraints work, just not this one

No. Constraint evaluate before ?Prompt execute (before any actions in the rule executed).

This is classic misunderstanding.

1 Like

so, I find that odd then as I have a system setting prompt above an action that takes the info from that system setting to create an entity name…

unless its literally just constraints and maybe that’s looking for written data in the database?

Just try Execute automation command after ?prompt.

I’m doing that now, almost done…

Kick my ass if it doesn’t work lol.
1st Rule ?prompt then exec 2 rule
2nd rule Entity Data

nope still nuttn

I’m going to bed lol… else ill be up all night

Thanks for trying to help though, much love

Read this in the morning again, you may have typo somewhere.
In the rule all constraints (in every actions) will be evaluate all at the same time before any action taken.

When rule first executed, Entity Data still null because ?prompt was not executed yet. So, constraint evaluate with null data or whatever previous data store in the field.

3 Likes

This is 100%, you can’t set a value like entity data is 1sr action and have a constraint on 2nd action using that field as constraints are worked out at rule start… The constraint in 2nd rule will be based on the initial value before any actions are run.
As @sukasem said to do that you would need to split it a seccond rule, even just an execute auto command without value as the 2nd rules action constraints will then be evaluated at that point.

3 Likes

the way its set it won’t work like that, i think ill just add a manual ‘Add Deposit’ button instead.

Edit… yes it did work like that, standard story of my life: misspelt in second rule

all sorted, thanks guys

so as not to create a separate topic

I have “create account transaction document” action
in the “amount” field:

big monstrous formula

[=F((TN('{REPORT ORDER DETAILS:([O.Total]/[OS.cou]).Sum:(OS.empl1={ENTITY NAME}) AND O.Total>0}')/100*TN('{REPORT ENTITY DETAILS:EC.Pay Rate percent of sale:(EN={ENTITY NAME})}'))+(TN('{REPORT ORDER DETAILS:([O.Total]/[OS.cou]).Sum:(OS.empl2={ENTITY NAME}) AND O.Total>0}')/100*TN('{REPORT ENTITY DETAILS:EC.Pay Rate percent of sale:(EN={ENTITY NAME})}'))+(TN('{REPORT ORDER DETAILS:([O.Total]/[OS.cou]).Sum:(OS.empl3={ENTITY NAME}) AND O.Total>0}')/100*TN('{REPORT ENTITY DETAILS:EC.Pay Rate percent of sale:(EN={ENTITY NAME})}'))+(TN('{REPORT ORDER DETAILS:([O.Total]/[OS.cou]).Sum:(OS.empl4={ENTITY NAME}) AND O.Total>0}')/100*TN('{REPORT ENTITY DETAILS:EC.Pay Rate percent of sale:(EN={ENTITY NAME})}'))-TN('{ACCOUNT TRANSACTION TOTAL:Нарахування зарплати:{ENTITY NAME}}'))]

and it creates a transaction without any problems that I need, but only if the result of the formula is not 0.
if 0 then it opens the standard transaction creation form (which is not needed)

and having chosen different options, I cannot find the correct syntax so that a transaction is created (or not)
exemple.
custom constraint:
'[=F ... ]' != '' '[=F ... ]' > '0' [=F ... ] > 0 [=F ... ] != 0
not work

It would help to know the expression your comparing to.
If you quote either side of the != Comparason it should force string value. So generally we quote because we are looking at non numerical values like states or tags etc.
When it’s numerical it would depend on the output of the expressions as if it returned identical number in any format it would work but as string values 0 in format of 0 and 0.00 are not identical.
The TN(’’) wrap forces the contained expression to be evaluated as a numerical.number value and should also make a null value 0.
Using this is a must for large/smaller expressions as you can get a ==/=! Expression to work while treating numbers as stings however larger smaller 100% need numbers.

Without seeing for full expression it’s hard to say.

1 Like

full expression hidden under the spoiler “big monstrous formula”

1 Like

What’s the =F achiving?

Looking through that I’m just trying to follow what’s going on.

First question I think of is why not simplify to (OS.empl1 + OS.empl2 +OS.empl3 + OS.empl4)/100*EC.payrate%-transaction total