Skip to main content
Question

Loop through columns and dynamically get column number

  • February 23, 2023
  • 6 replies
  • 1015 views

Forum|alt.badge.img+4

Hi Team! 

for my current robot I need to get data table from the website (this is the website: https://www.bnr.ro/Exchange-rates-1224.aspx) and extract values from column where column name is yesterday’s day. It will not be a fixed column number or column name. 

 

I was wondering if you have any best practices how to extract data from data table where column name is a variable?

 

Many thanks for helping! 

6 replies

Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • February 23, 2023

Hi @Kasia 8214 ,

 

Do you need to extract data from all available column or from any specific one?


Forum|alt.badge.img+4
  • Author
  • Cadet | Tier 2
  • 7 replies
  • February 23, 2023

Hi @Padmakumar,

 

only specific column - column named with yesterday’s date

 

thanks!


Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • February 23, 2023
Kasia 8214 wrote:

Hi @Padmakumar,

 

only specific column - column named with today date

 

thanks!

 

If it is coming like this all the time, then you can go with the Index number right? Means, last column will always going to be the previous day data.

 


Forum|alt.badge.img+4
  • Author
  • Cadet | Tier 2
  • 7 replies
  • February 23, 2023

My bad! Apologies, yesterday date :) 


Forum|alt.badge.img+4
  • Author
  • Cadet | Tier 2
  • 7 replies
  • February 23, 2023

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 


Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • February 23, 2023
Kasia 8214 wrote:

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 

Kasia 8214 wrote:

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 

 

You can extract the table and save the data into an excel file. Later using Database action and SELECT query, look for the column with previous day date (Before this, you should assign a variable and save the previous day date with the same format which is available in the portal) and extract the exchange rates from it.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings