Expand my Community achievements bar.

SOLVED

Value in a cell should not be negative

Avatar

Level 2

Hi!

This is probably very simple to those of you that is familiar with scriptning....

I'm unfortunately not one of these so I have to beg for help.

I have a table (Table1). In this table I have different numeric fields to use in calculations. I've different names for all fields in the table. Different row-names as well.

It goes from Row1 to Row13 and the fields are named from Cell1 to Cell127.

I want to calculate something like this (FormCalc),

I am in Table1.Row6.Cell56 where I want this operation to take place:

First I add the values in "Table1.Row6.Cell54" and "Table1.Row6.Cell55", then I compare it with the value in "Table1.Row6.Cell53". If this sum is negative there should be default 0 as a value if the vaule is above 0 the real value should be shown in this cell

Ex

Cell54 = 77, Cell55 = 3, Cell53 = 90

Result shown in Cell56 = 10

Cell54 = 31, Cell55 = 2, Cell53 =27

Result shown in Cell56 = 0 (the result is -6)

1 Accepted Solution

Avatar

Correct answer by
Level 2

Ok, I finally solved my own problem... a good nignts sleep did the work!

AND as usually I made the problem bigger than it was, that is SO me

This works:

if ((formulär1.Huvud.Table1.Row3.Cell23 -

(formulär1.Huvud.Table1.Row3.Cell24 +

formulär1.Huvud.Table1.Row3.Cell25)) < 0)

then 0

else

(formulär1.Huvud.Table1.Row3.Cell53 -

(formulär1.Huvud.Table1.Row3.Cell54 +

formulär1.Huvud.Table1.Row3.Cell55))

     endif

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Ok, I finally solved my own problem... a good nignts sleep did the work!

AND as usually I made the problem bigger than it was, that is SO me

This works:

if ((formulär1.Huvud.Table1.Row3.Cell23 -

(formulär1.Huvud.Table1.Row3.Cell24 +

formulär1.Huvud.Table1.Row3.Cell25)) < 0)

then 0

else

(formulär1.Huvud.Table1.Row3.Cell53 -

(formulär1.Huvud.Table1.Row3.Cell54 +

formulär1.Huvud.Table1.Row3.Cell55))

     endif