Skip to main content
I'm trying to show the last value in a multi-value XML field and it is not working (my terminology might be off, this is new stuff for me). Example XML:

<sodas>
<soda>
<name>Coke</name>
<isCaffinated>Yes</isCaffinated>
</soda>
<soda>
<Name>Sierra Mist</name>
<isCaffinated>No</isCaffinated>
</soda>
...
</sodas>

If set the xpath on a k2textbox to name using the dialog, I end up with:
/ns1:sodas/ns1:soda/ns1:name

This sets the field to the first node (Coke), but what I want is the last node. So I change it to this:
/ns1:sodas/ns1:soda[last()]/ns1:name

I think my syntax is OK, but it does not work. The field is blank.

Any ideas on how to do this? I'm fine with just using a regular text box and setting the value in the PageLoad, but I don't know how to bind to the XML data (or how to loop through it).

Any ideas?
Looks like nobody has tried this. How about just getting some field data? I've looked thrugh a bunch of the sample code and they always use a "k2.processinstance" property, but I get an undefined error on "k2" (when working in VS). Do I need to bind to the actual process first, using the serial number? Can anyone point me do some sample code?

Thanks,
Blue

Reply