Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

FormCalc error using count in a dynamic form with repeat row min set to 0

Avatar

Level 1

Hi,

I am generating a flowed table with 2 aggregation levels using a XML data binding. 1st level INCOMES_TAXED, 2nd level DETAILS

The following formula works nicely as long as there is a minimum of 1 RowDetail displayed.

if (count($record.INCOMES_TAXED.INCOME_TAXED[*].DETAILS.DETAIL[*].TAX_CHF)>0) then

$=sum(DATA.Row1[*].DATA.RowDetail[*].TAX_CHF)+0

endif

When the XML data file has no DETAILS for IMCOMES_TAXED, no RowDetail are displayed in the table and then I get the following error:

accessor $record.INCOMES_TAXED.INCOME_TAXED[*].DETAILS.DETAIL[*].TAX_CHF is unknown.

Strangely, this error doesn't happen when no INCOMES_TAXED elements are in the XML file.

This can be easily solved by setting the repeat row min to 1, but it generates unecessary blank lines.

Is there a better way to check if either the RowDetail exists or if DETAILS elements are in the XML.

Thanks

3 Replies

Avatar

Level 10

When a Row can be set to 0 instance, the only way to access that row is to use the underscore "_Row1" which access directly to the instanceManager of the object.

It is bypassing through the object Row1 because it doesnt exist in that  case, it's the only way to work around with the object...

you absolutely need 1 instance to be able to work with it...

Hope this help

Avatar

Level 1

I made some tests using "_RowDetail" (as I am interested in testing the second level) but I didn't succeed with a 2 level Table as:

707811_pastedImage_0.png

It is why I tried to use the count on the XML structure that is bind on it, hoping to be able to check if there is a TAX_CHF element in: "$record.INCOMES_TAXED.INCOME_TAXED[*].DETAILS.DETAIL[*].TAX_CHF. But this is when I get the error accessor $record.INCOMES_TAXED.INCOME_TAXED[*].DETAILS.DETAIL[*].TAX_CHF is unknown".

Avatar

Level 1

I solved the problem using resolveNodes

var I=form1.INCOMES_TAXED.DATA.resolveNodes("Row1[*].DATA.RowDetail[*].AMT_CHF").length

if (I > 0) then

     $=sum(DATA.Row1[*].DATA.RowDetail[*].AMT_CHF)

else

     $=0

endif