Support Forum

Ask questions and get help from MobileTogether experts.
MobileTogether Product Information
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
inc  
#1 Posted : Tuesday, August 5, 2014 3:17:10 PM(UTC)
inc

Rank: Newbie

Groups: Registered
Joined: 8/5/2014(UTC)
Posts: 6
Estonia

Trying to build master-detail page: Master is list (XML) from one source (http:...) and Detail is just table from second source http:.../123 where last number comes from first source (like some sort of ID). Clicking on one label in list must renew small detail table.

In case if I have in list only one item, it works. If I have more (eg 32 rows), then I get error:

Wrong occurrence to match required sequence type
Details
XPTY0004: The supplied sequence ('32' item(s)) has the wrong occurrence to match the sequence type xs:anyAtomicType ('zero or one')

On list I have "repeating table" (tried also "repeating rows") and label with action:
Load from HTTP: $XML2 (XML)
Source: concat($PERSISTENT/Root/ServiceRootURL, $XML1/root/row/@id)

I also have one label in list having same expression (for testing porpuses) and it shows correct/different data on every row.

If I change action source as follows:
Source: concat($PERSISTENT/Root/ServiceRootURL, $XML1/root/row[1]/@id)
then XML2 got refreshed and its content corresponds to first row ([1]).

I think that repeating table/row should do trick for me but it doesn't. Since it doesn't my question is how to point on action script to "current" rows data (instead of constant [1])?

bbv  
#2 Posted : Tuesday, August 5, 2014 9:59:06 PM(UTC)
bbv

Rank: Administration

Groups: Registered, Administrators
Joined: 7/21/2014(UTC)
Posts: 498

Was thanked: 88 time(s) in 88 post(s)
Very easy: within either a repeating table or repeating row the XPath context is the repeating element. All you need is to change your absolute XPath to relative, which in your case is just @id.

So the source path will be concat($PERSISTENT/Root/ServiceRootURL, @id)

I honestly don't know how the other label with the same statement can show you correct data - you didn't attach your MTD file, so it will be impossible to find out, but it cannot work.


Altova MobileTogether Experts
inc  
#3 Posted : Wednesday, August 6, 2014 6:47:11 AM(UTC)
inc

Rank: Newbie

Groups: Registered
Joined: 8/5/2014(UTC)
Posts: 6
Estonia

In case I put into repeating table the *label* with XPath expression there are in in builder view fulfilled (below left) context ($XML1/root/row). And it works so (actually desinger/builder is smart enough to use relative path ("Absolute XPath" is unchecked and doubleclick adds short relative expression)).

But for "Load from HTTP" Source [...] -- opens same expression Builder but there are written "<no context available>" and "Absolute XPath" checkbox is checked and disabled.
So, how to say that really I have context?


Source code is

<PageXMLRootXML id="55" name="XML1" readOnlyXML="1" loadBeforePageOpen="never" hasUrl="1">
<children>
<PageXMLElement id="56" name="root" from="xml">
<children>
<PageXMLElement id="57" name="row" from="xml">
<children>
<PageXMLAttribute id="58" name="id" from="xml"/>
<PageXMLAttribute id="59" name="tekst" from="xml"/>
.....
And
<DesignTable id="12" pageXML="57">
<style addDelPossible="0" repeating="1"/>
....
there are 2 things inside this repeating table
<DesignLabel id="20" pageXML="59">
<style name="Label4"/>
<controlActions id="39">
<children>
<DesignActionLoadFromHttp id="181" xmlRootRef="185">
<HttpSettings so="1" id="182" url_so="concat($PERSISTENT/Root/JuurURL, @id)" urlIsXPath_so="1" returnsNewXML_so="1"/>
....
and
<DesignLabel id="173">
<style name="Label13" text_x="concat( $PERSISTENT/Root/JuurURL, @id)"/>

Latter is fine, first one behaves wrongly:

Load from HTTP '$XML2'
Executed on server: HTTP: URL has an invalid XPath 'concat($PERSISTENT/Root/JuurURL, @id)'
Context item is undefined
Details
XPDY0002: Cannot evaluate expression '@id', because the context item is undefined

How to force builder to use context?
bbv  
#4 Posted : Wednesday, August 6, 2014 7:54:37 AM(UTC)
bbv

Rank: Administration

Groups: Registered, Administrators
Joined: 7/21/2014(UTC)
Posts: 498

Was thanked: 88 time(s) in 88 post(s)
Sorry, looks like you ran into missing functionality - we need to enable context use within Load command.

A workaround for you would be to use some absolute text node (for example, create an attribtue in $PERSISTENT tree) to save there URL and then execute Load.

Update Node in some XML tree with @id
Load from HTTP
inc  
#5 Posted : Wednesday, August 6, 2014 8:47:49 AM(UTC)
inc

Rank: Newbie

Groups: Registered
Joined: 8/5/2014(UTC)
Posts: 6
Estonia

Workaround works. Thanks.
Users browsing this topic
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.