Expand my Community achievements bar.

SOLVED

Hide repeating table row based on value?

Avatar

Level 1

Hi,

I'm having difficulty with a scripting problem. I would like to hide any table row 'DATA_COND' where VTEXT within that row is equal to "Price".

This is the code I have created that does not work:

for (var a=0;a<data.BODY.ITEM_DETAIL.DATA_DETAIL.count;a++){

for (var b=0;b<data.BODY.ITEM_DETAIL.DATA_DETAIL[" + a + "].DETAILS.ITEM_CONDITIONS.CONDITIONS.DATA_COND.count;b++){

  if (xfa.resolvenode("data.BODY.ITEM_DETAIL[" + a + "].DATA_DETAIL.DETAILS.ITEM_CONDITIONS.CONDITIONS.DATA_COND[" + b + "].VTEXT").rawValue== "Price"){

   xfa.resolvenode(data.BODY.ITEM_DETAIL[" + a + "].DATA_DETAIL.DETAILS.ITEM_CONDITIONS.CONDITIONS.DATA_COND[" + b + "]).presence="hidden"; 

   }

  }

}

Where DATA_DETAIL repeats for each item and DATA_COND repeats for each item

Any pointers to where I might be going wrong?

Many Thanks!

Matt

1808071_pastedImage_0.png

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

there's some minor details you need to fix in your code, see the following:

Bold text is where I amended the code

instanceManager needs to be accessed to manage instances of the object itself.

It also can be accessed by using an underscore before the name of the object in question like the following:

I hope this will help

Let me know if you need clarifications..

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi there,

there's some minor details you need to fix in your code, see the following:

Bold text is where I amended the code

instanceManager needs to be accessed to manage instances of the object itself.

It also can be accessed by using an underscore before the name of the object in question like the following:

I hope this will help

Let me know if you need clarifications..

Avatar

Level 1
Hi I'm having the same issue and I can't see your amendments. Please assist. Thank you

Avatar

Employee Advisor

Can you send the form please?

Avatar

Level 10

You can propably do the same with just one line of code in the calculate event of "DATA_COND":

this.presence = VTEXT.rawValue === "Price" ? "hidden" : "visible";