Hi.
I don't know what is the real value & meaning of the columns you are using. Also I'm guessing (but don't know for sure) that you are using Powerbuilder 12.5 and it's help... If I'm right, then I would suggest to use pb's 12 help files, as they are more accurate and provide better coverage of product features.
Know the key is that: a) you must provide a default value (as Matt Balent suggests in the previous message), b) if you use the rgb function then the result should be provided as a string!
The following comes from PB's 12 help files:
red_amount = Integer(sle_1.Text)
modstring = "emp_id.Color='" + &
String(RGB(red_amount, 0, 0)) + &
"~tIf(emp_status=~~'A~~'," + &
String(RGB(255, 0, 0)) + &
"," + &
String(RGB(red_amount, 0, 0)) + &
")'"
Modify(modstring)
(Help subject is Advantage and drawbacks of Modify and Describe methods in PowerBuilder).
Now based on the previous one I'm using in one application the following to check the logic (and it works fine also in PB 12.5).
dw_label_40x20.modify("barcode_text_field.Color='" + string(rgb(0, 128, 0)) + "~tif ( isnull(barcode_no), " + string(rgb(128, 0, 0)) + ", " + string(rgb(0, 0, 128)) + ")'")
(Of course in one line!)
Based on the help (and my example which works), I would modify a little your script as follows:
ls_ = "campo2.Background.Color='" + string(rgb(128, 0, 0)) + "~tif ( campo2 < fido, " + string(rgb(255,0,0)) + ", if ( campo2 > ( abs(fido) * -1 ) and campo2 < abs(fido) , " + string(rgb(255,255,0)) + ", " + string(rgb(255,255,255)) + " ) )'"
Of course this is shown in multiple lines here, but if you want to put it in multiple lines inside your script then you should use the & character...
And of course you continue...
dw_stampa1.Modify(ls_)
Notice that after color= follows a ' character which closes at the end " ) )'" of the command.
Andreas.