Four Js Development Tools Forum

Discussions by product => Genero Studio => Topic started by: Jeremy G. on August 10, 2015, 03:42:54 pm



Title: colorCondition
Post by: Jeremy G. on August 10, 2015, 03:42:54 pm
Hello,

I'm searching documentation about widget propertie : colorCondition.

What I want :

On a table of record, if the article # is 2, I want all the line in red.

I tried with this condition : "COLOR = RED WHERE "id" > 2" (the name of my first column is "id")
and others test didn't work.

Can anyone coud help me please?

Regards.


Title: Re: colorCondition
Post by: Jeremy G. on August 10, 2015, 03:45:38 pm
sorry, the condition : "COLOR = RED WHERE "id" > 2"


Title: Re: colorCondition
Post by: Stefan S. on August 11, 2015, 08:13:16 am
Hello Jeremy,

to have some Colors in the Table we use dialog.setArrayAttributes in the program.
To use it you have to create a second array for the arrtibutes.

Fill the array...
Code
  1.   define lo_color  dynamic array of record
  2.                     color01     string,
  3.                     color02     string
  4.                 end record
  5. ...
  6.         case lo_xxx
  7.            when " "
  8.               let pa_color[lo_ii].color01 = ""
  9.               let pa_color[lo_ii].color02 = ""
  10.            when "A"
  11.               let pa_color[lo_ii].color01 = "reverse yellow"
  12.               let pa_color[lo_ii].color02 = "reverse yellow"
  13.            when "F"
  14.               let pa_color[lo_ii].color01 = "reverse green"
  15.               let pa_color[lo_ii].color02 = "reverse green"
  16.         end case
  17. ...
  18.         --then before display....
  19.         display array pa_ntze to s_anz.*
  20.            before display
  21.               call dialog.setArrayAttributes("s_anz",lo_color)
  22.  


Title: Re: colorCondition
Post by: Reuben B. on August 12, 2015, 01:01:10 am
Hi,

I would suggest the DIALOG.setArrayAttributes path as suggested by Stefan as it does give you more flexibility, although with a bit more coding required.  Hopefully one day we will have a setArrayStyles equivalent so that you can do more than just colour.

However to answer your original question, there does appear to be an inconsistency between the documentation and the product, so there will need to be a task created.  What I eventually did was create a .per form that worked that had ...

EDIT f01 = formonly.field1 , COLOR=RED WHERE f01 <0;

 .. when I imported that into a .4fd, when I looked at the value for the ColorCondition property that had

COLOR = RED WHERE $VALUE < 0

So I suspect the Studio documentation needs to have its examples updated to make it clear that to refer to the value, you use the keyword $VALUE.

However you were trying to set the whole line to be red.  The COLOR WHERE / ColorCondition only applies to the current field.  In a. per when you compile you will get the following error if you try to reference another field.

error:(-2045) The conditional attributes of a field cannot depend on the values of other fields.

So as suggested by Stefan, I suspect you want to use the DIALOG.setArrayAttributes method .

Reuben