Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

conditional data binding question

Avatar

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
PiPiLee
Level 1

26-07-2018

Hi, guys

I'm new bee in LiveCycle Designer. I got questions about conditional data binding question in adobe Live Cycle  designer ES3.

My XML files structure is like following:

<item>

     <Name>name1</Name>

     <Type>A</Type>

     <Amount>10</Amount>

</item>

<item>

     <Name>name2</Name>

     <Type>B</Type>

     <Amount>20</Amount>

</item>

<item>

     <Name>name3</Name>

     <Type>B</Type>

     <Amount>30</Amount>

</item>

........

And now I want to display items only with type= A . How can I get this conditional data binding?

I've already use SOM predicates in item's Data Binding expression like this:  $.item.[Type=='A']   but it return syntax error.

BR, PiPi Li

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

26-07-2018

Hi,

When you use $.item.[Type=='A'], that is with square brackets then the expression is expected to be a FromCalc expression, which means you need to use double quotes, i.e. $.item.[Type=="A"].  The JavaScript equivalent would be $.item.(Type.value=='B') ... using the round brackets.  I do tend to stick with FormCalc for predicates, it is meant to be a little faster.

Regards

Bruce

Answers (5)

Answers (5)

Avatar

Avatar
Validate 1
Level 2
arthurf48713214
Level 2

Likes

8 likes

Total Posts

30 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
arthurf48713214
Level 2

Likes

8 likes

Total Posts

30 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
arthurf48713214
Level 2

26-07-2018

Hi Pipi Li,

i´am not 100% sure but i thing you can use something like this check the value all type of your tree :

$data.resolveNodes('RootNode.item[*].Type') .item(*).value; // i thing for every item, it should return his value then you can check this value ; if ....,item(*).value == "A".

Arthur

Avatar

Avatar
Validate 1
Level 2
ulibaehr
Level 2

Likes

2 likes

Total Posts

71 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
ulibaehr
Level 2

Likes

2 likes

Total Posts

71 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile
ulibaehr
Level 2

26-07-2018

That appears unnecessary to me.

Conditional bindings without any scripting perfectly perform the task. You do not need to script for this kind of task.

I just checked with one of my example forms:

$.Legobrick.[Color<>"green"]

works perfectly to bind only subforms where the underlying element "Color" does not have the value "green".

Avatar

Avatar
Validate 1
Level 2
arthurf48713214
Level 2

Likes

8 likes

Total Posts

30 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
arthurf48713214
Level 2

Likes

8 likes

Total Posts

30 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
arthurf48713214
Level 2

26-07-2018

exactly.

Avatar

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
PiPiLee
Level 1

26-07-2018

Hi, Arthur

Thanks for ur reply. Do you mean add check script to Event?

BR, PiPi Li

Avatar

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
PiPiLee
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
PiPiLee
Level 1

26-07-2018

Hi Bruce,

$.item.[Type=="A"] still can not work. But the JavaScript predication $.item.(Type.value=='B') works. Thanks so much.

BR, PiPi Li