How to get index of the cell value in UiPath - uipath

I am trying to get the index of the cell value in an excel sheet using Uipath.
I have tried using Lookup range inside Excel application scope but its giving up the first similar value found in the Sheet as having duplicate values as well.
Please Suggest how we can find the the exact index Of the cell.
I have used
LookUp Range activity
Read Cell Formula
Col1 Col2 Col3
DB AB BB
AC DB AN
AK AB AC
I need to find the IndexOf value DB , located at Col2 2nd row

I would use a For-Each item in DB activity.
You can iterate through the lines and access the value with item(0).toString e.g⠀
Then you can go on and check up the location of your searched text.
If you run a counter with it, you can easy detecting the Row and Col number of your searched field.

If you want to lookup in column B alone then you can set range as "B:B" in the Lookup Range Activity.
It will search the value in Column B and give you the index found in the 2nd column.
enter image description here

1.Read the Excel it will stored in DAtatable DT
2.Use for each row in datatable
3.Use if condition inside the loop
currentrow(1).tostring. Contains(“DB”)
4.Take Assign activity
Var_Index(int Datatype) = DT.Rows.indexof(currentrow)
Its may be work….

Related

Google Sheets Query - use a reference cell to select which columns to select in a query

I would like for a Google Sheets Query to choose which columns to select based on a cell reference. "select X" for example where the column header equals a cell that I reference. This is different from selecting which rows of a column to display. I want the Colx to be based on a cell reference.
Specifically, the data has different column headers with dates. I want the query to select the column that matches a particular date or any of the headers I may have in a drop down menu.
I used this format but it did not work
=query('Schedules'!A:N,"select A,B,C,D,E,K,H,J,L,M, '"&A2&"' WHERE N=1 and K !='HR(PD)' ORDER BY B,K",1)
This is the cell reference to the column I am looking for: '"&A2&"'
in A2 I have the letter of the column I want to use
Your current formula maybe a bit spotty with the quotes placement. You can see a working sample here:
=query(A:D,"Select A,"&F1&" Where A is not null")
based on header match
=query({A:D},"Select Col1, Col"&xmatch(F1,A1:D1)&" Where Col1 is not null")

Power Query Replace null values with values from another column

I am working with data imported from a pdf file. There is an extra column in the Power Query import (Data.Column7), containing data that belongs in the adjacent columns on either side (Data.Column6 and Data.Column8). Columns 6 and 8 have null values in the cells where the data was pushed into Column 7. I would like to replace the null values in Columns 6 and 8 with the correct data from Column 7, leaving all other values Columns 6 and 8 as is.
After looking at the post here:
Power Query / Power BI - replacing null values with value from another column
and watching this video:
https://www.youtube.com/watch?v=ikzeQgdKA0Q
I tried the following formula:
= Table.ReplaceValue(#"Expanded Data",null, each _[Data.Column7] ,Replacer.ReplaceText,{"Data.Column6","Data.Column8"})
(Note, "Expanded Data" is the last step before this Replace Value step.)
I am not getting any kind of syntax error, but the Replace Value step isn't doing anything at all. My null values in Columns 6 and 8 have not been replaced with the correct data from Column 7.
Any insight into how to achieve replacement would be greatly appreciated. Thank you.
(I should mention, I am a new Power Query user, so please be detailed and assume I know nothing!)
I'm sure there must be some way to do this with the ReplaceValue function, but I think it might be easier to do the following:
1: Create a new column with definition NewData6= if[Data.Column6]=null then [Data.Column7] else [Data.Column6]
2: Do the same thing for 8 : NewData8= if[Data.Column8]=null then [Data.Column7] else [Data.Column8]
3: Delete Data.Column6/7/8
4: Rename the newly made columns if neccesary.
You can do these steps either in the advanced editor, or just use the create custom column button in the add column tab.
If the columns are of the text data type, then it might have empty strings instead of actual nulls.
Try replacing null with "" in your formula.

Google Sheets SQL Query

I need your help in an SQL query in Google Sheets
I need a query to Select columns that have for example A1 in their name
My problem is that i have more than 150 columns that contain A1 in their title so a query like
query(range,"select D E F where .....") is not helpful as i need to write by hand more than 150 columns!!
So i need a query that either selects columns with certain string in their name or a sggestion to add a specific range in select claus
Here is an example image
and the link of my sample form https://docs.google.com/spreadsheets/d/1pYr1Rx0VasXjmAQC0qa9zNC_3rAdg_dxUKLy42zFTCY/edit?usp=sharing
Thanks in advance
try:
=TRANSPOSE(QUERY(TRANSPOSE(B3:M15), "where Col1 matches 'date|name|^A1.+'"))

How MAX of a concatenated column in oracle works?

In Oracle, while trying to concatenate two columns of both Number type and then trying to take MAX of it, I am having a question.
i.e column A column B of Number data type,
Select MAX(A||B) from table
Table data
A B
20150501 95906
20150501 161938
when I’m running the query Select MAX(A||B) from table
O/P - 2015050195906
Ideally 20150501161938 should be the output????
I am trying to format column B like TO_CHAR(B,'FM000000') and execute i'm getting the expected output.
Select MAX(A || TO_CHAR(B,'FM000000')) FROM table
O/P - 2015011161938
Why is 2015050195906 is considered as MAX in first case.
Presumably, column A is a date and column B is a time.
If that's true, treat them as such:
select max(to_date(to_char(a)||to_char(b,'FM000000'),'YYYYMMDDHH24MISS')) from your_table;
That will add a leading space for the time component (if necessary) then concatenate the columns into a string, which is then passed to the to_date function, and then the max function will treat as a DATE datatype, which is presumably what you want.
PS: The real solution here, is to fix your data model. Don't store dates and times as numbers. In addition to sorting issues like this, the optimizer can get confused. (If you store a date as a number, how can the optimizer know that '20141231' will immediately be followed by '20150101'?)
You should convert to number;
select MAX(TO_NUMBER(A||B)) from table
Concatenation will result in a character/text output. As such, it sorts alphabetically, so 9 appears after 16.
In the second case, you are specifiying a format to pad the number to six digits. That works well, because 095906 will now appear before 161938.

CheckBox in Oracle Forms

I have a Database block contains 3 columns. in that all are character columns.
I have created a multi record block in a form which contains 2 text item and one check box.
The values in the table are like below
col1 col2 col3
value1 value2 N
Value3 value4 N
Value5 value6 Y
In the form, I want to find only the records with Value 'N' in the col3.
I want to find the values using Enter - Query, Execute Query method, But here in my form, col3 is the checkbox. if ticked -Y, not ticked value will be 'N'.
I know, we cannot search 'N' values using Enter - Query, Execute Query method.
Is there Any other way we can search?
Your problem is that in enter-query standard functionality is that the checkbox contains an empty value (null) and is not unchecked. To search for an unchecked value just go in enter-query mode and click the checkbox to have the "Y" value in your case and click it again to have the "N" value. From now on you can check and uncheck the value.
If you have made a mistake and want it to be empty again use the clear item key to set it back to null.
If you want to allow querying the block based on the checkbox, you need to have the checkbox values stored somewhere, probably in a Y/N column on the table that the block is based on.
Before the block is queried, you'd just need to ensure the checkbox values are posted to the database.
If you can't save them to the table itself, an alternative would be to save them somewhere else, but it has to be something accessible to the query itself - e.g. a global temporary table.
Why not use the check box to enter the needed search criteria form col3? I can't see why that should not be possible and I even tested it quickly. Please try the following
Set properties of your checkbox for col3 as follows
Value when Checked = Y
Value when Unchecked = N
Check Box Mapping of Other Values = Not Allowed
Initial Value = N or Y whatever suites your business need
Database Item = Yes
Column Name = col3
If using this kind of settings you can in Enter Query mode select if you want the query for col3 = N by making sure that the check box is unchecked when executing the query.

Resources