How to filter/select value from table that depends on multiple columns in a Java app?

Hi everyone

Can you shed some light on how I can select a value from a table, that depends on multiple columns?

For an example

I have a table that has column Patient Name and a column Exam.

So from an Java app where I have thousands of rows of data, I want to select specific people that have these values and combine to get the specific patient to click upon it.

Column Patient Name: John Smith
Column Exam: XRAY

I manage to do the Patient Name with Dynamic Selectors but I don’t know how to add colName = ‘Exam Type’.

<java name='APPOINTMENT: Listings' role='internal frame' />
<java role='table' idx='1' />
<java role='label' colName='Patient Name' name='{{LName}}, {{FName}}' idx='1' />

But how to add the logic to look for one more column and combine both to do the selection?

Hi @Mihajlo_Stojanovski,

Are you able to get UiExplorer to examine the selector for XRAY, that is after the selecting/filtering the Patient Name? Hint: press F2 to pause the identify element to manually select/filter Patient Name.

Essentially, you need two clicks. For the first click, you already identified the Patient Name selector. Second click, you have to identify the Exam selector.

If the selector cannot be found for Exam Type, a workaround is to navigate using “Send Hot Keys” to tab/move to the Exam Type and “Type Into” the Exam.

I envision you have a “For Each Row” where each row contains LName, FName and ExamType to combine your selection.

No I actually I don’t have a For Each Row.
I was trying to use dynamic selectors to “filter” data in this entire table and to concatenate a filter right in the selector to click a specific patient.

So basically

" Filter John Smith AND Filter Xray AND Date "

The data is in separate columns, so I find it difficult to select values in multiple columns.

Ideally it would be {{FName}}{{LName}}{{Exam}}{{Date}}

So, your suggestion is to extract the data table, for each row, combine it, and …click it ? The click part I am not entirely sure how to do it? Any tips where I can see a similar Java App solution with table selection?

Hi @Mihajlo_Stojanovski,

No. Do not scrape data. Use two clicks where first click is select Patient Name and second click is select Exam Type.

Have an excel file as data source with three columns firstname, lastname and examination. Read Range the excel file and store into datatable where you can iteratively performs two clicks for each patient.

I don’t think that would work if I am not mistaken

Here is an example with John and Joan Smith.

You need to click on John Smith XRAY 05/10/2020

Patient Name Exam Date
Joan Smith XRAY 05/10/2020
Joan Smith USND 03/10/2020
Joan Smith MRI 04/10/2020
John Smith XRAY 05/10/2020
John Smith USND 06/10/2020
John Smith MRI 02/10/2020

So let’s say you clicked upon John Smith - OK
You need to click on XRAY? But the robot will not differentiate which XRAY to click? John or Joan?
Again the same thing with the date - you have two 05/10/2020.

So the robot needs to know some how, some AND logic that Patient Name AND Exam AND date are connected.

Hi @Mihajlo_Stojanovski,

Is the UiExplorer able to identify and highlight individual fields value? If yes, please screen capture the UiExplorer for Patient Name, Exam and Date. That’s 3 UiExplorer screen captures.

Hi @Mihajlo_Stojanovski,

Selectors are internal property of an application. You cannot just define or create a concatenated filter that does not exist.

@Mihajlo_Stojanovski

Can you check the difference selectors in below three
John Smith XRAY 05/10/2020
John Smith USND 06/10/2020
John Smith MRI 02/10/2020

As i don’t have access to your website, what i understood is

You are trying to make to highlight the name dynamically

But the idx also have to change accordingly

One way you can try is to try to extract the value of the table to a data table using Datascrapping

Once you did, you can check the index of the row which value is exist

Then you can use that index into the idx

Follow Link

Hope this may helps you

Thanks

Hope this will shed some light on the issue:

If I Indicate an element in the selector I get this

<java role='label' tableCol='1' tableRow='3' />

Then I go to UiExplorer and I do this

image

This then gets converted to this

<java role='label' colName='Patient Name' name='Surname, First Name' idx='1' />

what I do next is

<java role='label' colName='Patient Name' name='{{LName}}, {{FName}}' idx='1' />

So the idea is to dynamically allocate these values when it does the selection, which works fine.

The problem is that I have other columns that are depending on this selection (not just name and surname). I have an exam. Which I if indicate it on screen looks like this:

<java role='label' tableCol='7' tableRow='3' />

After the changes in Ui Explorer
image

it gets convrted into

<java role='label' colName='Exam Type' name='CT SCAN' idx='1' />

Using a dynamic selectors this gets transformed into

<java role='label' colName='Exam Type' name='{{Exam}} idx='1' />

Which clicks fine.

The problem I am facing is how to combine the two with Dynamic selectors for an example, or some other alternative, so it selects John Doe, CT SCAN, 24/01/2020 lets say.

Hi @Mihajlo_Stojanovski,

You have a consistent pattern for both selectors

  1. rowName has same value 24/02/2020 for both selectors of Patient Name and Exam Type
  2. tableRow has same value 3 for both selectors of Patient Name and Exam Type

Recommendation:
So your first click selector which is Patient Name, should be
<java role='label' colName='Patient Name' name='{{LName}}, {{FName}}' rowName='{{examDate}}' idx='1' />

where examDate is String variable with value 24/01/2020

After the first click which is Patient Name using the same Patient Name selector, you need to use activity “Get Attribute” to get the value of attribute “tableRow”. Store the output value 3 to a variable - rowNumber

For the second click which is the Exam Type, your selector should be
<java role='label' colName='Exam Type' name='{{Exam}} rowName='{{examDate}}' tableRow='{{rowNumber}}' idx='1' />

where examDate is String variable with value 24/01/2020, rowNumber is a String variable that you obtain from the activity Get Attribute.

Note: Personally, I do like the idx=‘1’ attribute, so i would recommend to add more attributes using trial-by-error until idx=‘1’ attribute is automatically removed.

Hey Green Tea

Thank you for your insight. I really appreciate the effort!

The only thing that confuses me here is “the second click”?

I do not have a second click. I need to click once on one row that has multiple columns.

So let’s say I have an input from API John Doe XRAY 06/10/2020

With one click I need to select the appropriate patient with the appropriate date and exam from the table.

Btw, as for the Get Attribute - tableRow does not show up in the drop down :confused:

Hi @Mihajlo_Stojanovski,

It is strange… how did you get the screenshots for two different selectors with the UiExplorer.

Could you screenshot, remember to mask any patient information, like name, etc ?
Please indicate on the screenshot where you want to click once only.

Just to verify that the row you wanted to highlight/click once only is row number 3, right?

Btw, the Get Attribute Input is “tableRow”

So this is the table.
This is one patient. When the table is presented I need to make sure I click only once on a patient that has a specific name, and Target Date. By clicking on this patient it opens up a new window to edit further information.

Any ideas Green Tea?

EXAM selector

EXAM TIME

Please note that rowName is a different field unrelated to the Exam Time. It is a field that shows when the booking was made, not the actual date for the booking. Like a log.. So the correct values here are ‘name’ and ‘virtualname’.

2 - ExamDate

So these are the two selectors for Exam and ExamTime.

I need to combine the two, when I am looking for the exact time and exam.

As if there was an AND connection between the two, and I the system needs to find that with one click.

Hi @Mihajlo_Stojanovski,

Are the two selectors shown, EXAM and EXAM TIME, on the same row ?

If yes, there is a potential solution based on same tableRow number

  1. search on java form for Patient Name that matches the Patient Name and return all the tableRow numbers
  2. search only the rows from step 1 that match the Exam Type and return all the tableRow numbers
  3. search only the rows from step 2 that match the Target Date and return the tableRow number

OK, here are the selectors for EXAM and EXAMTIME. I managed with another filter to narrow done the exam patient (Filter in the software)

EXAM:

<wnd app='java*.exe' cls='SunAwtFrame' title='Name of the app' />
<java name='APPOINTMENTS:' role='internal frame' />
<java idx='1' role='table' />
<java role='label' tableCol='6' tableRow='0' />

EXAM TIME:

<wnd app='java*.exe' cls='SunAwtFrame' title='Name of the app' />
<java name='APPOINTMENTS:' role='internal frame' />
<java idx='1' role='table' />
<java role='label' tableCol='13' tableRow='0' />

So, can you please explain a bit more the solution you suggested?

Using dynamic selectors :

EXAM:
< wnd app=‘java*.exe’ cls=‘SunAwtFrame’ title=‘Name of the app’ />
< java name=‘APPOINTMENTS:’ role=‘internal frame’ />
< java idx=‘1’ role=‘table’ />
< java role=‘label’ colName=‘Exam Type’ name=‘{{Exam}}’ idx=‘1’ />

EXAM TIME:

< wnd app=‘java*.exe’ cls=‘SunAwtFrame’ title=‘Name of the app’ />
< java name=‘APPOINTMENTS:’ role=‘internal frame’ />
< java idx=‘1’ role=‘table’ />
< java role=‘label’ colName=‘Target Date’ name=‘{{ExamDate}}’ idx=‘1’ />

So here are all the variants.

I tried to understand your answer, but I cannot comprehend how to return the tableRow?

Can you shed some light on how to achieve this?

Hi @Mihajlo_Stojanovski,

Please take a look at this Get Attribute cannot get Java attribute of element unless/until it was manually selected with UiExplorer on information about get attribute activity.

By attribute you refer to tableRow?

As I understood the explanation this is in regards to Virtualname?

Hi @Mihajlo_Stojanovski,

That’s the example only. You have to apply to tableRow attribute

I did some testing and the whole tableRow approach (I managed to get in Get Attribute) although it is good, it doesn’t solve one problem.

Example:

I have two exams:

XRAY 14/10/2020
XRAY 15/10/2020

I want to double click on 15/10/2020 to open more details.

The first click is Exam right? XRAY. It clicks the first XRAY.
Then I get the attribute tableRow which in this case would be 0.

So now, the Exam Date, is basically useless because it will always select the first Exam that fits the selection (in this case XRAY) and it will always be 0. So Exam Date even though it was tableRow = {{rowNumber}} that {{rowNumber}} will always be 0, since it “locks” itself on the first found Exam that fits the {{Exam}} dynamic selector.