Expand my Community achievements bar.

Choice Subform Set: No data displayed when "expression" is used

Avatar

Level 4

Hi,

I try to get my form working with a repeating "choice subform set".

I have 2 different subforms in my set: Whenever the XML-element "type" has value "A" I want to show subformA. Same with value "B" and subformB.

The problem is: I never get to see any data. :-(

This is how my XML looks like:

<ourPlants>
    <plant>
        <type>cropPlant</type>
        <name>apple tree</name>
        <harvestMonth>9</harvestMonth>
        <yield>100</yield>
    </plant>
    <plant>
        <type>cropPlant</type>
        <name>pear tree</name>
        <harvestMonth>10</harvestMonth>
        <yield>50</yield>
    </plant>
    <plant>
        <type>ornamentalPlant</type>
        <name>rose</name>
        <color>red</color>
        <odor>none</odor>
    </plant>
</ourPlants>

My hierarchy looks like this:

setOfPlants (choice subform set)

cropPlant (subform with this binding: $.plant.(type=="cropPlant"))

yield (text field)

ornamentalPlant (subform with this binding; $.plant.(type=="ornamentalPlant"))

color (text field)

In my repeating "choice subform set" I picked "Choose subform using expression". The first alternative subform got the binding "$.plant" and the expression 'type=="cropPlant"'. The second alternative subform got the binding "$.plant" and the expression 'type=="ornamentalPlant"'.

Actually it is strange that the Designer generated the subform bindings without the "[*]"-notation. I would have expected a binding like:

$.plant[*].(type=="cropPlant")

But even when I overwrite this binding that way I still don't get any data into my form.

I did some extensive googeling but cannot find a good example of choice subform sets where "expression" is used. Everybody seems to use only the "Chooce Subform Whose Name Matches Data Element or Attribute"-option.

Does anyone have any idea what could be wrong with this form? Does anyone have a working example with this technique?

[I could e-mail you my sample form and XML.]

Uli

0 Replies