in my DOM I have like 3 tables and each table has several input fields, is it possible to write xpath let say for 3rd input of 2nd table
I can locate only first input of each table, so I assume that its bracket thing
i did try
(//table[#class='table-name'])2[3]
also
((//table[#class=‘table-name’])[2])(//input)[3]
"the third input out of the second table":
((//table)[2]//input)[3]
first, this selects all tables from the document, regardless of their position //table.
then it picks the second one from that set (//table)[2]
going from this one, it selects all nested inputs (//table)[2]//input
and from this set, it picks the third one
Note that (//table)[2] is "from all tables anywhere, take the second one" whereas //table[2] is "take all tables who are the second child of their respective parents". The the former expression can only ever select a single table, while the latter can select more than one.
Related
My first task is to add two new columns to a table, first column stores the values of M and X fields values in a single column(as a single unit with a pipe separator) and second column stores O and Z fields values in a single column(as a single unit with a pipe separator).
second task selecting agency and external letter rating(shown in image) from drop down and after saving the form the value from fields M and X should move to N and Y and this values should be stored in table column that are created from task one, Now if we save the form the values should move to O and Z fields in forms and this should continue.
Can any one help me how to proceed with this and I don't know how to separate a column value into pieces and display on form.
Better if you propose any new method that does the same work.
Adding columns:
That's a bad idea. Concatenating values is easy; storing them into a column as well. But, then - in the next step - you have to split those values into two values (columns? rows?) to be joined to another value and produce result. Can you do it? Sure. Should you? No.
What to do? If you want to store 4 values, then add 4 columns to a table.
Alternatively, see if you can create a master-detail relationship between two tables so you'd actually create a new table (with a foreign key to existing table) with two additional columns:
one that says is value stored related to M or Y
value itself
It looks like more job to do, but - should pay off in the future.
Layout:
That really looks like a tabular form, which only supports what I previously said. You can't "dynamically" add rows (or, even if you could, that's really something you should avoid because you'd have to add (actually, display) separate items (not rows that share the same item name).
I have two database blocks: A and B. I also have 3 tabs:
first tab has items from block A,
second one has items from block B,
third one has items from block A
All fields from both blocks are required.
My problem is that I want to enter fields in the order of tabs, but in my case because of required fields when I want to go to the second tab, it takes me to the third to enter all fields, and then the second one.
How to solve this?
When you navigate from the first tab (based on table/block A) to the second tab (based on table/block B), Forms perform validation and - as not all required fields that belong to table A (the ones that are placed to the third tab) aren't populated - Forms raises an error.
One option would be to remove the "Required" property from all fields that belong to table A and are placed to the third tab. It means that you'd have to check whether they are populated manually, i.e. write a trigger which would do that. Which one? PRE-INSERT and PRE-UPDATE might be your choices. Code would look like
if :tab3.field1 is null or
:tab3.field2 is null or ...
then
message('Not all fields have been populated on tab 3');
raise form_trigger_failure;
end if;
Or, rearrange the layout by
moving fields from tab 3 to tab 1, or
switching tab 2 and tab 3 positions
Or, if the process goes like that, maybe your data model is wrongly set. What you described looks like some kind of a "master-detail" relationship, where table A acts as "master" and table B as "detail". You shouldn't populate master partially, especially not if all its columns are required. If that's the problem, well, then it really is a problem as changing data model doesn't necessarily be simple as it affects quite a lot of things.
I have a specific problem concerning XPath.
Say I can get a column from the table using this query:
//div[#id="someid"]/table/tbody/tr/td[9]/text()
However, I want to only get this column when another specific node exists.
I tried using:
//div[#id="someid"]/table/tbody/tr/td[9 and boolean(//a/span[#title='specifictitle'])]
This however does not work as it returns all items in the table.
I have a few specific limitations:
- //div[#id="someid"]/table/tbody/tr is static and cannot be changed.
- The td contains no other info concerning what column it is in.
Thanks in advance!
2 approaches:
First - as a direct condition within square brackets:
//div[#id="someid"]/table/tbody/tr[//a/span[#title='specifictitle']]/td[9]/text()
this approach is simpler and the position does not matter
this is also the approach that fulfills the OPs requirement, that the query should start with //div[#id="someid"]/table/tbody/tr
* You can basically put the condition [//a/span[#title='specifictitle']] to whatever element in the query you want (could also be behind tbody or table etc.)
Second - using axes (for example ancestor)
2 cases regarding the position of your element within HTML code:
1) anchor-element "before" your div with "someid":
//a/span[#title='specifictitle']//div[#id="someid"]/table/tbody/tr/td[9]/text()
2) anchor-element "after" your div with "someid":
//a/span[#title='specifictitle']/ancestor::div[#id="someid"]/table/tbody/tr/td[9]/text()
In both cases the xpath-query will not return a result if the //a/span[#title='specifictitle'] does not exist, which is what you needed, if I understood correctly
I have a flat file that I'm trying to transform into X12_00401_820. When I use the table looping and table extractor, the loop never happens.
Below is my map:
Below is the output. The invoice numbers are looping right, but I'm only getting the first amount, not the amount for each invoice.
The first input parameter to this functoid must be a scoping link, and
the second represents the number of columns in the data grid.
The first parameter of your functoid is the scope, you have to set your scope to SellersInvoiceNumber (don't link it graphically just write in input[0] SellersInvoiceNumber )
The second parameter of your functoid is the number of columns, you have to put 2 there as you will have two columns in your grid
So the third and fourth parameters will be your SellersInvoiceNumber and Invoice amount field (link it graphically as you already did)
Don't forget to configure your columns in the Table Looping Grid but i guess you've already done that
This should work
I've been trying to find a way to even search for this without much luck.
Basically, I've got a text field in a table. All I'm trying to do is check if that text field contains a particular string, in this case, if this field contains either "OLD", "OBSOLETE", or "FOM" and then move it to the very bottom of the list, leaving everything else sorted normally. Is this possible? I'm trying to do this without hitting the SQL Statement itself too much if at all.
You can do this by using a switch statement in the expression/function related to the sort. Logically a switch() is very similar to a case statement.
Under 'sorting options' add a new sort line item (or modify the existing item) by clicking the expression button to the right (Fx)
Then Modify the sort expression similar to this:
=Switch(Fields!YourField.Value="Old","xxx",
Fields!YourField.Value="Obsolete","yyy",
Fields!YourField.Value="Fom","zzz",
1=1,Fields!YourField.Value)
This creates a switch statement that replaces the value to be sorted of the items you mentioned to xxx,yyy, & zzz effectively moving their sort value to the end of the list. Their displayed value will remain the same.
Switch stops evaluating when it finds the first true; so the final 1=1 is basically the otherwise clause that says sort by whatever the actual value of your field is when not old, obsolete, or fom.