Please enable JavaScript to view this site.

InterFormNG2 Manual

Navigation: Designer > Design tips

XPath wizard

Scroll Prev Top Next More

When you in InterFormNG2 insert a value in a field, then you for most have these options:

 

1.You can insert a fixed text.

2.You can type a dynamic XPath expression where you need to remember each XPath function and the matching parameters.

3.For some you can also use the XPath wizard for finding XPath functions and keep the correct syntax. The wizard also includes a description of each parameter. The wizard option is only available for some entry fields.

 

This section of the manual shows how you can use the XPath wizard, when you enter an XPath expression. Apart from the wizard you may also find help in the example of the XPath section.

 

For the XPath wizard there are these features:

 

1.Enable XPath and verify that the wizard is available for the entry field.

2.Search and insert an XPath function

3.Prompt an inserted XPath function

4.Switch to manual entry and back

5.Limitation of the XPath wizard

 

 

 

Enable XPath and verify if the Wizard is available for the entry field

One way to find out if the XPath wizard runs for a specific entry field it to first set it in XPath mode. For the contents of a text element you first need to select Expression and then ensure that the magnifying glass is shown on the right as below:

 

NG2XPathWizard001

 

Then you can use the XPath wizard by entering a part of the XPath function, that you want to insert. If you e.g. type string, then you will see a list like below:

 

NG2XPathWizard002

 

Now we are sure, that the XPath wizard is available for this entry field.

 

 

Search for an XPath function

If you want to search for an XPath function, then you simply type a part of the function name. The text that you search for does not need to be the leading part of the function name. The search result contains any built-in function (which are the functions, that starts with ng:) or standard XPath function which contains the search text. That means, that if you e.g. search for string, then you see all functions, that is related to string.

 

If you e.g. search for number, then you see all functions, that contains number:

 

NG2XPathWizard003

 

 

List all XPath functions

If you want to list all available functions, then you can just enter a text and then delete it again and you will see this:

 

NG2XPathWizard004

 

On the right there is a slider (marked with the arrow) that can be dragged down to see them all.

 

 

Description and help for the functions

If you are in doubt as to which function to select, then you just place the mouse over any of the functions listed above. Then a description of the function and parameters are shown:

 

NG2XPathWizard005

(Above we have placed the mouse on the substring() function).

 

 

Insert the function

When you have found the function, that you want to insert, then you can simply click on it to insert it. When you have inserted it you can consider to prompt it.

 

If you instead prefer to type in the expression yourself, then you can just type it in instead of clicking on a function.

 

 

 

Prompt an inserted XPath function

After you have inserted an XPath function it is time to insert the parameters. For the parameters it is important that the number of parameters, the sequence and the value of each parameter is correct. The XPath wizard can help you with that.

 

You will see something like below after you have inserted an XPath function:

 

NG2XPathWizard006

 

Below the function you might see an error message if e.g. parameters are missing.

 

You can prompt the function if you click the this icon on the right:

NG2XPathWizard007

 

Now another window pops up which shows the function and the parameters. A description is included below the function name and each parameter:

 

NG2XPathWizard008

 

For each parameter you can on the left see the type of data, which is required. In the middle you can again enter an XPath function, which can also be searched for via the wizard and on the right you can see the calculated value for each parameter. In the example above we are selecting the characters from 1 to 3 of the node: /IF_Type/Settings/ReportID in the input XML file.

 

The value of this expression is in this case INV, which you can see if you click Apply all:

 

NG2XPathWizard009

 

As you can see above the input field for the function locked, so you cannot directly change the parameters from this screen. If you want to still use the wizard you can click this icon on the right to prompt the command again:

 

NG2XPathWizard007

 

Alternatively you can switch to manual entry.

 

 

Switch to manual entry and back

If you want to use the XPath wizard for searching and prompting, then you need to stick to the XPath wizard. The alternative to the XPath Wizard is, that you type in all the functions yourself. This is called manual entry.

 

If you want to switch from the XPath wizard into manual entry, then you just click the marked <> icon on the right:

 

NG2XPathWizard010

 

Then you have full freedom when you type in the expression:

 

NG2XPathWizard011

 

But now you are on your own and the XPath wizard is pretty much not available. If you click the E icon on the right, then you request the editor to go back to the XPath Wizard, but currently that only works for a simple function without any parameters, so for most you will just get an empty entry field if you click this icon and you need to build up the expression again with the wizard. If you immediately regret the change you can of course click cancel or roll back the last change of the template.

 

 

Limitation of the XPath wizard

The XPath wizard is a great tool, but as you can see in the section, Switch to manual entry and back the XPath wizard only works for XPath expressions, that has been entered with the XPath wizard, so you cannot use the wizard for XPath expressions, that has not been entered with the wizard.