Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: colorCondition  (Read 12541 times)
Jeremy G.
Posts: 12


« 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.


* Sans titre.png (2.59 KB, 478x97 - viewed 2067 times.)
Jeremy G.
Posts: 12


« Reply #1 on: August 10, 2015, 03:45:38 pm »

sorry, the condition : "COLOR = RED WHERE "id" > 2"
Stefan S.
Posts: 90


« Reply #2 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.  
Reuben B.
Four Js
Posts: 1049


« Reply #3 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


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines