Validation issues

Hi, first off i try to describe table structer as short as possible. 

I need to make 2 operation from other table - movement operation and 3 from - triple. For this i have 2 bot's which contain event and two for movement, three for triple steps. All of this tables have field [Amount] which can't be lower than Account balance from table accounts for outcome operation. 

For that i have valid_if formula in operation table:
IF(
[Type] <> "Outcome",
TRUE,
IF(
[_THISROW].[Account].[virtualAccount] = "Yes",
TRUE,
[Amount] <= [_THISROW].[Account].[accountBalance]
)

As well less complex validation formula in movement and triple. 

I know that account balance > than outcome operation which should be done, but it doesn't works. 

error example: 
Error encountered in step with name [Outcome operation]: Error: Perform DataAction 'Action for Outcome operation' failed because Row having key 'gb5IKE1cFE46aX_1B0Vom6' in table 'operations' containing value '11' in field 'Amount' failed 'Valid_If' condition

Without valid_if formula in Amount into operation table everything works

Solved Solved
0 3 122
1 ACCEPTED SOLUTION

The Valid_If specifies what is allowed not what is dis-allowed.

You state...


@AlexeyLogicode wrote:

All of this tables have field [Amount] which can't be lower than Account balance


but your expression has this


@AlexeyLogicode wrote:

...

[Amount] <= [_THISROW].[Account].[accountBalance]

...


These two contradict each other.  You say that amount cannot be less that Account balance but your Valid_If is confirming that it IS less than Account balance.

I don't know your system but normally, in a financial system, Amount would refer to the amount of a transaction.  And usually transactions adjust the balance and are EXPECTED to be less than or equal to the Account Balance.   This would mean that your Valid_If is doing the right thing.

The question then is, when processing via a Bot do you WANT the validation to be applied.  If so then you need to see what the data is not valid.

If you wish to BYPASS validation, you can use the CONTEXT() function with the "Host" argument to do so. For example, you could use it like this:

IF(
OR([Type] <> "Outcome",
CONTEXT("Host") = "Server")
TRUE,
IF(
[_THISROW].[Account].[virtualAccount] = "Yes",
TRUE,
[Amount] <= [_THISROW].[Account].[accountBalance]
)

I hope this helps!

 

View solution in original post

3 REPLIES 3

The Valid_If specifies what is allowed not what is dis-allowed.

You state...


@AlexeyLogicode wrote:

All of this tables have field [Amount] which can't be lower than Account balance


but your expression has this


@AlexeyLogicode wrote:

...

[Amount] <= [_THISROW].[Account].[accountBalance]

...


These two contradict each other.  You say that amount cannot be less that Account balance but your Valid_If is confirming that it IS less than Account balance.

I don't know your system but normally, in a financial system, Amount would refer to the amount of a transaction.  And usually transactions adjust the balance and are EXPECTED to be less than or equal to the Account Balance.   This would mean that your Valid_If is doing the right thing.

The question then is, when processing via a Bot do you WANT the validation to be applied.  If so then you need to see what the data is not valid.

If you wish to BYPASS validation, you can use the CONTEXT() function with the "Host" argument to do so. For example, you could use it like this:

IF(
OR([Type] <> "Outcome",
CONTEXT("Host") = "Server")
TRUE,
IF(
[_THISROW].[Account].[virtualAccount] = "Yes",
TRUE,
[Amount] <= [_THISROW].[Account].[accountBalance]
)

I hope this helps!

 

I'm sorry, my mistake in words. Sure amount can't be higer, not lower. Your answer really helped me. Can you give me some explanation how CONTEXT works. Tell me if i'm right that "Server" it's about system processes like bots? 

I provided a link to the article on the CONTEXT() function.  You should review it.

You are correct, "Server" refers to processing occurring on the server mostly due to automation but it can be for other processing such as Virtual Column calculations.

Top Labels in this Space