make the value of field negative or positive

hey guys

How do I make the value of field "B" negative
If field "A" = true
or positive
If field "A" = false

Solved Solved
0 9 1,390
1 ACCEPTED SOLUTION

As I understood from the post, you want to make the value positive or negative. 

If instead you wanted to check the validity of the value using Valid if, then you should use this expression:

IF([A] = "Debit", [_This] < 0, [_This] > 0)

View solution in original post

9 REPLIES 9

Aurelien
Google Developer Expert
Google Developer Expert

Hi @alfakeah 

You can use the Valid_If expression on the column B settings (black pen):

OR(
  AND([_THIS]<0,[A]),
  AND([_THIS]>=0,NOT([A]))
)

Aurelien_0-1653327523413.png

 

Aurelien
I thank you
But the expression did not work

Do I put the expression in field "B"?

IF([A], ABS([B]) * -1, ABS([B]))

Thank you Joseph

What do you mean by "ABS" ?

Lovely
This expression was modified by me

IF([A]="Debit", ABS([B]) * -1, ABS([B]))

put it in Valid_If expression

But it doesn't work and it gives me this message:
The expression is valid but its result type 'Number' is not one of the expected types: Yes/No, List

What's the solution?

As I understood from the post, you want to make the value positive or negative. 

If instead you wanted to check the validity of the value using Valid if, then you should use this expression:

IF([A] = "Debit", [_This] < 0, [_This] > 0)

I really need the first expression that makes the value positive or negative
But I put it in the box.
App formula
But the field disappears because the expression deals with a value already entered in field "B".
And I want the user to enter the value in field "B".

 

Columns having an app formula can neither be edited through user input nor through actions. The solution is to have this formula in another column, and use this new column in calculations and in the app views.