cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional colorization of table lines

Former Member
0 Kudos

Hello

I have to colorize lines with totals and subtotals content within a table. To do so, I want to implement a script into the line element. The colorization without condition can be done easily with the following script in FormCalc:

this.fillColor="240,18,200"

But how can I access the "total level"-indicator? It is available in the context as a component of the table line record. But it is actually not represented by an element on the form.

The context node is (see also attached screen shots):

     RESULTS[ ]

          DATA

               LINES[ ]

                    DATA

                         TOTST (total level indicator, type CHAR(1))

(Note: This table-in-table construct is intended and works perfect as required).

I am unexperienced with FormCalc and JavaScript. I tried several things in FormCalc such as

  • if ($record.RESULTS_VJ.DATA.LINES.DATA[*].TOTST=="1") then
  • if (this.TabLine.TOTST.rawValue=="1") then
  • if (TabLine.TOTST=="1") then
  • if (this.TabLine.TOTST=="1") then
  • if (totst.rawValue=="1") then
  • if (totst=="1") then
  • if ($record.totst=="1") then

As you can see from the trials above, I have no clue about scripting 😉

May somebody help me with this condition?

Thx in advance!

Cheers

Bodo

Accepted Solutions (1)

Accepted Solutions (1)

sandeep_katoch
Contributor
0 Kudos

Hi Bodo,

Its a bit tricky but you can create a textelement bind it with totst value on the form and make it hidden. From there you will get the value of indicator totst in the form scope.

Hope it helps

Rgds,

Sandeep katoch

Former Member
0 Kudos

Hi Sandeep

thanks, your hint already helps.

I know how to access the value of an element (e.g. if (this.rawValue=="X") then). But how can I access the rawValue of a subnode? Please consider that I have to implement the script on the line element level and the TOTST indicator is a component (= an invisible cell) of the line.

Best Regards

Bodo

sandeep_katoch
Contributor
0 Kudos

Hi Bodo,

Please try this with certain variations i.e by giving path instead of table name

On the TOTST text filed write a java script like

If (this.rawValue == "1") then

xfa.resolveNode("xfa.tablenavigation from form").fillColor = "Specify Color";

Endif

If still not able to solve than send me the xml of form on my email id sandeepkatoch77@gmail.com

I will try to solve

  

Hope this helps

Rgds,

Sandeep Katoch

Former Member
0 Kudos

Hi Sandeep

your first hint solved my problem. To address the line color control indicator (named TotSt in my example), I had to

  • insert a corresponding column into the table
  • bind the cell text field to the corresponding context item
  • set the new column to hidden and
  • write the script on the line element like this:

if (this.TotSt.rawValue=="9") then

this.fillColor="200,200,200"

endif

Thanks a lot for your help.

Best Regards

Bodo

Answers (0)