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

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]))
)

2 Likes

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

1 Like

Aurelien
I thank you
But the expression did not work

Do I put the expression in field “B”?

Thank you Joseph

What do you mean by “ABS” ?

ABS() command returns the absolute value القيمة المطلقة of a number/decimal. It is part of AppSheet’s Math Expressions.

1 Like

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)

3 Likes

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.

2 Likes