Can I use column properties in expressions in Powerbuilder?

Let's say I have a field in the data window that is the value of the database column (Insert> Column). It has the conditions under which it must be protected (Properties> General> Protection).

I want the field to be gray when it is protected. At the moment, the only way I can do this is to copy the conditional protection condition, no matter how difficult, replacing the values โ€‹โ€‹1 (protect) and 0 (do not protect) for the color values.

Is there some kind of syntax that I can use in the Expression field for the background color of the column that refers to the protection value of the column? I tried

if (column.protect = 1, gray, white)

but it returns an erroneous statement that it expects a TRUE / FALSE condition.

Is this what I am after impossibility, or is it just a matter of getting the right syntax.

Greetings.

+3
source share
1 answer

Wow. You like complex, multi-level questions.

The first problem is accessing a value that does not execute as you described. Essentially, you use Describe () to get the value. The only problem is that it returns as a string in the following format with quotes (note that we use the standard PowerScript notation, where ~ t is the tab)

"<DefaultValue>~t<Expression>"

You need an expression, so you have to parse it, as well as quotation marks.

, . Describe(), :

Describe ("Evaluate('<expression>', <rownum>)")

, , GetRow().

, PowerScript , , , - ( b):

if (Describe ("Evaluate (~"" + Mid (Describe ("b.protect"), 
Pos (Describe ("b.protect"), "~t")+1, 
Len (Describe ("b.protect")) -  Pos (Describe ("b.protect"), "~t") - 1) 
+ "~", " + String (GetRow()) + ")")='1', 
rgb(128, 128, 128), 
rgb(255,255,255))

, Mid() , , , Protect Describe (Evaluate()) .

. , Protect, Evaluate() . Protect, Protect (~ "), , , . , ( , , ), (" column.protect") GetRow() PowerScript, .

,

.

+6

Source: https://habr.com/ru/post/1730485/


All Articles