Robot Framework how to use FOR loop for a specific column in a table - for-loop

I want to know how to use a FOR loop for a specific column in a table.
Basically. I want to get the text in the third column and equate / verify it to be "LOCAL" for all rows. I will provide a basic diagram of the table
So, in the diagram the checkboxes take up as first table cell and the top row is a table header.
What i want is to get the text of all the cells under column /th4 and equate it to be as "LOCAL" as said before. There might be multiple entries and will be dynamic. So, that is why i want to use FOR loop.
PS: every cell under /th4 is LOCAL , so just want to equate the text.
My code:
Click Element xpath=//*[#id="selectType"]/div/div[2]/ul[2]/li/div
Sleep 0.1
Click Element class=dropdown-btn
Sleep 0.1
Click Button id=filterBtn
Sleep 0.1
Click Element id=closeFilter
Table Row Should Contain xpath=//*[#id="myTable"]/tbody/tr[1]/td[4]/span 1 LOCAL
Table Row Should Contain xpath=//*[#id="myTable"]/tbody/tr[2]/td[4]/span 2 LOCAL
Table Row Should Contain xpath=//*[#id="myTable"]/tbody/tr[3]/td[4]/span 3 LOCAL
Basically, there is filter option... once i filter, the fourth /td in the table will all contain text "LOCAL".
Instead of me manually typing "table row should contain" keyword, i want to for loop it to verify all the cells in that column
Let me know if any other information is required.
Thanks and Regards,
Sandesh K S

For loop is not the best option here because you usually need to know beforehand how many elements you have and you mention that number of rows can change. It would be better to use while loop:
${row}= Set Variable 1
WHILE True
${elements}= xpath=//*[#id="myTable"]/tbody/tr[${row}]/td[4]/span
${num_elements}= Get Length ${elements}
IF '${elements}' == '0'
BREAK
END
Table Row Should Contain xpath=//*[#id="myTable"]/tbody/tr[${row}]/td[4]/span 1 LOCAL
${row}= Evaluate ${row} + 1
END

Related

how to fetch previous values of a table in oracle forms

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).

how to add one more data block item in oracle forms [duplicate]

In the below given example like rejection date it has total 5 rows of same type.
when i tried to create new data block item like issue date(issue date is table column) I'm getting only one row (I want to get 5 rows as shown below.)
Forms does that itself, but you have to add that new item into that block. Because, it is
block's Number of records displayed property
item's Number if items displayed property
that affect number of "rows" you'll see.
For example, if block's number of records displayed is set to 5 (as it apparently is) and you add a new item to that block and set appropriate canvas, Forms will create 5 instances of that item. You can then choose not to display all of them but any number between 0 and 5 (where "0" also means "all of them" (5 in this case)).

Highlighting with slicer Power BI

I have a Dashboard with different visuals.
Data is made up of different values for insurance companies.
I want my slicers/filters to not filter all data, but to only highlight the chosen company.
For example, in my slicer I choose the insurance ABN.
Instead of showing me the value for ABN only in my visuals, I want all other values to still be visible and ABN's value to be highlighted in the visuals.
Does anyone know how to do this?
You can use conditional formatting to achieve this. Lets say that we will change the background color to "highlight" a row (or cells, to be precise).
First, we need a slicer, which will not filter our data. We can do this by duplicating our source table, removing the unnecessary columns and making sure there is no relationship between the source and the duplicate. So if we have a source table, named Table, like this:
Right click on it and select Duplicate:
Then right click the title of the column you want to keep and select Remove Other Columns to get a list of company names only (you may also remove the duplicates, but it's not required). Then in the model delete the relation between both tables:
Now you can place a table showing company name and sales from your data source, and a slicer for company name from the duplicate table. At this point selecting values in the slicer should not affect the table.
Now you need to capture the value of the slicer and use it in a measure, which will determine should current row be highlighted or not. You can use SELECTEDVALUE for that, but note that it will give you a value only if there is a one selected in the slicer. If you want to support highlighting of more than one company, it gets a bit more complicated.
Make a new measure in your source table, like this:
Measure = IF(HASONEVALUE('Table (2)'[Company name]);
IF(SELECTEDVALUE('Table (2)'[Company name]) = MAX('Table'[Company name]); 1; 0);
IF(ISFILTERED('Table (2)'[Company name]) && COUNTROWS(FILTER('Table (2)'; 'Table (2)'[Company name] = MAX('Table'[Company name]))); 1; 0))
In case there is only one value selected in the slicer (see HASONEVALUE), then our measure will return 1 (highlight) or 0 (don't), comparing it with the current row.
Otherwise (i.e. there is no selection in the slicer, or there are 2 or more companies selected), then we will look at the filtered list of companies (Table (2)) - if it contains current row, then 1 (highlight), otherwise 0 (don't). But we will also handle the case, where there is no value selected in the slicer. In this case the list will contain all the companies, i.e. all rows will be highlighted. Here comes ISFILTERED. And at the end, if the list is filtered and current row exists in the filtered list, then 1 (highlight), otherwise 0 (don't).
Now, you need to use this measure to change the background of the column - right click each column in your table and select Conditional formatting -> Background color:
Then format by rules, where Measure >= 1 like this:
Now, when there is no selection in the slicer, there are no rows highlighted in the table:
If you select one company, it is highlighted:
It also work if there are multiple companies selected:
Thank you Andrey for your step-by-step explanation which as been incredible helpful. I'd like to follow up with a further question, particularly regarding the comment below.
"You can use SELECTEDVALUE for that, but note that it will give you a
value only if there is a one selected in the slicer. If you want to
support highlighting of more than one company, it gets a bit more
complicated."
In my model, I've linked a third table (Table (3)) to Table (2) with a many to one relationship with Table (2). Therefore when I click on Table (3), it will filter Table (2), which acts as a slicer for Table (1).
When only 1 value is filtered in Table (2), it conditionally formats the cells in Table (1). However, when more than 1 value is filtered in Table (2), conditional formatting fails.
As I'm looking to avoid manually selecting multiple values in the slicer (Table (2)), I was wondering if there's a workaround for SELECTEDVALUE such that it is able to conditionally format when I filter more than 1 value in Table (2).

SSRS - Merge Repeating Texboxes w/ Distinct Row Values

Everything except for the name may or may not be different, but it doesn't matter.
How do you make it so the name and address (first column) can only show once if the value on multiple rows is the same? There is no way to merge the rows together due to the numbers of rows being generated from a group expression. But if there is another way to merge then can someone tell me how to do it? If not, then is there at least a way to blank out the second and third repeating names (and address)?
This is how you hide repeating values in a tablix column.
In design mode, click on the detail cell that you want to keep from repeating if the values are the same. In this case, you are referring to that one as the name and address column.
Look for the HideDuplicates property in the Properties pane. Set the value to the name of the dataset the tablix is using.
Now, when you run the report, that value should only show once. The other rows where the value had been repeating will be blank in that cell.
Set the borders appropriately (none, or solid) to make it look like the cells are merged. Doing the above alone will not merge the cells. Only a row group will do that.

How to check whether a column was deleted completely in a webtable?

How to check whether a column was deleted completely in a webtable using VB script?
I've created a row in a webtable and deleted it. I'd like to check whether the column is deleted from that webtable or not. I've written a script and having a tough time to write the logic. I can get complete row count from a webtable and can loop through one by one. But how to check whether that column was deleted from the webtab?
rowCount = SwfWindow(obj).SwfTable(tbl).RowCount
For i = 0 To rowCount - 1
names = SwfWindow(obj).SwfTable(tbl).GetCellData(i, 1)
If names = mycolname 'mycolname is the name of the column deleted Then
SwfWindow(obj).SwfTable(tbl).ClickCell i,1
Print "col name is present in the table"
Exit for
else
Print "col name is deleted completely from the table"
End If
Next
How do you want to identify the column? Probably by name. (The code shown in the question indexes by numeric index.)
It then depends on the webtable´s structure:
There is a WebTable runtime property returning the name of all columns in a string separated by a semicolon; iterate over the components of this string and query their names in the loop. If you find the to-be-deleted column in the process, it is still present, if not, it´s deleted.
See http://www.sqaforums.com/forums/hp-unified-functional-testing-uft-mercury-quicktest-pro-qtp/148239-qtp-function-web-table-get-column-number-giving-column-name.html for an example.
Sometimes, the table is organized a bit different, and the getROProperty call returns garbage. Then, you usually find the column names as cell data in row 1. There, you would need to iterate over the columns and use getCellData to look at the column name.
As pointed out by #TheBlastOne, the table you see in the AUT (application under test) does not necessarily tell the whole truth about how it is actually structured. The following is a neat trick, which should work for both WebTable and swfTable, to be able to see the actual structure of a table:
When you have both the AUT and QTP open, click the "Record" button in QTP
Choose to start recording on the open application
On the toolbar menu in QTP, select "Insert" --> "Checkpoint" --> "Standard Checkpoint" and click on the table in the AUT
A new window should now have opened, which, among other things, shows you exactly how the table is structured, i.e. row indexes and/or names, column indexes and/or names, etc.

Resources