Access to iterated controls in repeated sections in Orbeon - xpath

When setting repeated content in a section in Orbeon each control is repeated and the their names are the same. How do I access the the control from the first, second...etc instance of a control from each iterated section? I'm thinking along the lines of $control-name[instance#] or something similair.

The following works, given this form:
$name[2]: return the second value
string-join($name, ', '): join all values with commas
count($name): return the number of values
See also the relevant documentation.

To access this value in "bind" section, you can use a relative path , like ../name=''.
TO access this value in "body" section, then you can use context()/../name.
If you are trying to make anything different, be more specific and this answer can be edited to be according to what you want.

Related

ODI KM Option - value from FLEX FIELD

Do you think that it's possible to take a value into an ODI IKM Option (for example) from a flexfield?
Example:
You define a flex field on the target table and then pass the value in the IKM.
Then, reading the variable, it's possible to pass it to an option from the IKM?
Thanks,
After searching I found that it's not possible to do it. Conditional Expression can take predefined values. You can find in the next all the combinations:
Condition Expression – It allows you to set the required condition for
the selected option. Double-click the field for editing the condition
expression for the selected option. Click the browse icon Browse icon,
to launch the Edit Expression Editor, which enables you to create or
edit the existing groovy script that determines whether a knowledge
module should be enabled, disabled, displayed or hidden.
Examples are:
return
options.getValue("Cache").equals("true")?"show=true,enable=true":"show=false,enable=false";
This looks at the value of another KM Option called "Cache". If its
value is "false," then the KM Option is hidden, because it's not
relevant.
return
(isStreaming)?"show=false,enable=false":"show=true,enable=true";
This looks at the Mapping isStreaming property. If it's true, then
this option is hidden.
source
It is very easy to do.
You may use odiRef.getTable(java.lang.String pProperty) in the code of your IKM. One of possible values for pProperty is the code of your FlexField.
If you like to pass if through the option just pas <?…?>-substitution as a value of the option. (Probable you should play with %- or ?-substitutions, which is working.)
Refer to «Substitution API Reference» on Oracle site. Many functions like getTable, getIndex, getAK, getContext and others can obtain flexField value of an object of the corresponding type.
Additionally there is the odiRef.getFlexFieldValue() method. It gets the value of any object of any type, but it is required to pass internal IDs as an argument. So it is not convenient.

X-Path Query won't work in Google-Sheets

I've been trying to use the following X-Path within Google-Sheets with the =ImportXML function
=importXml("http://www.managetickets.com/morecApp/ticketSearchAndStatusTicketList.jsp?msgCount=23&outputEmail=&db=nd", "/table[2]/tbody/tr#[td]")
But no matter what minor adjustments I try I continually get "#N/A" with a hover-text box that says "imported content is empty".
I know it's a valid x-path, I've cross verified it with 'X-Path Helper Wizard' chrome-extension.
Any ideas what I'm doing wrong!?
No, actually it's not a valid XPath. Note that # used to select an attributes e.g. #class, #id, etc. Also it's a bad idea to use tbody tag in your expressions as this tag is not always present in initial source code
So if you want to match table rows which contain cells from second table, you can use
/table[2]//tr[td]

Correlating multiple dynamic values

How can I get the value of important id and ValueType?
I have tried using web_save_param_regexp (but unfortunately I don't fully understand how the function works).
I have also tried using web_save_param (with the help of offset and length).
unfortunately once again I cannot get the accurate value some values change in length specially when the total amount values dynamically changes per run.
<important id=\"insertsomevalueshere\" record=\"1\" nucTotal=\"NUC609.40\"><total amount=\"68.75\" currency=\"USD\"/><total amount=\"609.40\" currency=\"USD\"/><out avgsomecost=\"540.65\" ValueType=\"insertsomevalueshere\" containsawesomeness=\"1\" Score=\"-97961\" somedatatype=\"1\" typeofData=\"VAL\" web=\"1\">
Put these lines of code before the line of code which does your web request:
web_reg_save_param_regexp("ParamName=importantid","Regexp=<important id=\\\"(.*?)\\\"",LAST);
web_reg_save_param_regexp("ParamName=ValueType","Regexp= ValueType=\\\"(.*?)\\\"",LAST);
You will then have two stored parameters 'importantid' and 'ValueType'
Dynamic number of elements to correlate? Your path for resubmission is through web_custom_request(). You will need to build the string you need dynamically with the name:value pairs for all of the data which needs to be included.
This path will place a premium on your string manipulation skills in the language of the tool. The default path is through C, but you have other language options if your skills are more refined in another language.

Replace List Item Appinventor

I have a TinyDB and in each tag of the TinyDB I have a list.
Each list has 3 items, each indexed as 1, 2 and 3.
I want to change the 3rd item, index 3.
So I have done the following
So I want to now save the change in the TinyDB
and have added a storeValue command as follows.
I figured out how to get the valuetoStore variable. As follows.
I had done this before, and thought it wrong because it still doesn't change the 3rd item in the list. But I've added a notifier to look at it and it's correct. So the "replace list item" isn't working how I thought it should. It isn't replacing the 3rd item with an "n."
Any ideas?
Thanks.
Your second try is almost correct. The only thing is, you should use the replace list item block together with the local variable name instead of retrieving the value again from TinyDB.
So what is the difference to your "solution"? Currently you assign the list to a local variable name. Then you use the replace list item block together with a list, you can't store somewhere (you are loading the list again from TinyDB). And in the end you store variable name (which doesn't have been modified at all) in TinyDB. Therefore the solution is to use the replace list item block together with the local variable name instead of retrieving the value again from TinyDB. Btw. a better name for the local variable name would be list.
Further tips
Also in the definition of the local variable name you should add a block, e.g. an empty string or 0
And if you want simplify a little bit, you can move the definition of the local variable name inside the for each loop. And alternatively of using the for each number loop, for list it's easier to use the for each item in list loop, see also the documentation. The list in your case is TinyDB1.GetTags.
As already said in the forum, generally I would use a list of lists and store it in only one tag in TinyDB
How to work with Lists by Saj
How to work with Lists and Lists of lists (pdf) by appinventor.org

Best practice to show custom fields on dynpro?

I am assigned to implement new custom fields. The possible entries have to be selected from a value table. The value table holds the key and a explaning text. The dynpro is build like that:
Input for new field (zzfield) | Output-only field for explaining text. (zzfield_text)
What I want my dynpro to do:
a) Show text in output field based on entered key
b) Update text after ENTER/SAVE from user
c) Update text directly after a new key has been selected from the value table
My current solution is this:
" in the dynpro
PROCESS BEFORE OUTPUT.
MODULE GET_ZZFIELD_TEXT.
" in the module
DATA: zzfield_text TYPE string.
SELECT SINGLE text
FROM value_table
INTO zzfield_text
WHERE zzfield = mara-zzfield.
This works well for the cases a) and b) I have listed above. However, beeing in a PBO, it does not work for case c). My colleage suggested to use something like this:
" in the dynpro
PROCESS AFTER INPUT.
field: zzfield MODULE get_zzfield_text_pai ON REQUEST.
I can not duplicate my code in the module get_zzfield_text_pai, because the of the DATA declaration of zzfield_text. It is reported to be unknown in the PAI (besides it is already defined in the PBO module) but it is also reported to be duplicated if I declare it again in the PAI. Further, I dont know how to implement new global fields into my function group. Using another include creates again issues of that zzfield_text beeing unknown.
In general, I am not happy about my solution and would be very thankfull for each suggestion about how to code this feature.

Resources