IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#32657 - 06/25/09 11:19 AM Editable Xpath Value
-nth- Offline
OL Expert

Registered: 04/01/03
Posts: 236
Loc: Lincoln, NE
When designing a form with XML it would be nice to be able to quickly edit an object's xpath statement. When viewing an object's properties, though, the xpath value is "greyed" out. Meaning it can only be changed by opening the data selector and scrolling through the data file to find the new node or attribute. The current method can be tedious with large xml files. (It taunts me by showing a "paste" when right clicking on xpath statement, but it doesn't work) laugh

I know I can use the custom data selection property and paste a value in, but in my experience using the custom data selection breaks the Repeat - Iteration property which I need.

There may be a reason it's not editable, but I'd really like to see it follow the same convention as the ascii data types. They allow changing the data properties on the fly without having to browse out to the data file or use custom data selections.

Thanks,
-nth-

Top
#32658 - 06/25/09 12:33 PM Re: Editable Xpath Value
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
Yup, the XPATH is greyed out to make sure you can't mess with it... especially if you're using Repeats, since we need to automatically change the indexes in the XPATH to loop through each iteration.
I agree that it's not the most user-friendly way to do things, but it does prevent errors from occurring.

However, using custom data selections doesn't break the Repeat if you set it correctly. You simply have to "code" it properly.

For instance, let's say your XML data looks something like this:
Code:
Job
 |
 |--Record 1
       |
       |-- CustomerID
 |--Record 2
       |
       |-- CustomerID
 |--Record 3
 |
...
Let's say you want to print all Customer ID's. That means that you need to iterate on each Record token. To do so, select Custom Data Selection and set the value to
Code:
=XmlGet('/Job[1]/RECORD['+inttostr(&Current.Line)+']/CustomerID[1]')
As you can see, we're manually building the XPATH to take into account the current "position" of the repeat, which is stored in the Current.Line system variable.
Make sure the Data Selection Object is set to repeat on the
Code:
/JOB[1]/RECORD
Xpath to ensure Current.Line gets incremented to the proper value.

I hope that helps,
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#32659 - 06/25/09 01:01 PM Re: Editable Xpath Value
-nth- Offline
OL Expert

Registered: 04/01/03
Posts: 236
Loc: Lincoln, NE
That makes sense, so would it be possible to grey it out only if repeat or iteration is active? That would keep it "safe" when using repeat, but open it up when not.

-nth-

Top
#32660 - 06/25/09 02:09 PM Re: Editable Xpath Value
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
Sounds like a sensible compromise.

I'll put that in our database for a future release.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top