0

I apologize for my English. I want my flow in PAD to take the 'Yes' and 'No' values from a column in an Excel file And if yes, it opens the link from another column and write the value of the desired UI-element in the Excel file. If-condition and loop work well separately , but not together. Thank you for your help.

enter image description here

enter image description here

Skin
  • 9,085
  • 2
  • 13
  • 29
Mary
  • 1
  • 1

1 Answers1

0

Yeah, you need to think a little differently.

I've recreated your workbook (to a degree) with the following information in the relevant cells.

Data

When looping, you need to process one of the data tables and then get the index row from each other table from within the loop.

For example, loop over each priority and then for the given priority, get the URL in the corresponding row. Naturally, this means that both tables need be of the same size.

Bottom line though, you need to loop over each row and process each one individually. That's the main problem with your current script, it's trying to process the priorities in bulk, that won't work.

This script can be pasted into PAD and it will demonstrate the thinking you need to apply, just change the reference to the workbook and the columns, etc. ...

Excel.LaunchAndOpen Path: $'''c:\\temp\\Data.xlsx''' Visible: True ReadOnly: False LoadAddInsAndMacros: False Instance=> ExcelInstance
SET RowIndex TO 0
Excel.ReadCells Instance: ExcelInstance StartColumn: $'''A''' StartRow: 1 EndColumn: $'''A''' EndRow: 11 ReadAsText: False FirstLineIsHeader: True RangeValue=> URLs
Excel.ReadCells Instance: ExcelInstance StartColumn: $'''B''' StartRow: 1 EndColumn: $'''B''' EndRow: 11 ReadAsText: False FirstLineIsHeader: True RangeValue=> Priorities
LOOP FOREACH Priority IN Priorities
    SET URL TO URLs[RowIndex]
    IF Priority = $'''Y''' THEN
        Display.ShowMessage Title: $'''URL''' Message: URL Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END
    Variables.IncreaseVariable Value: RowIndex IncrementValue: 1 IncreasedValue=> RowIndex
END
Excel.Close Instance: ExcelInstance

You can see I have a variable called RowIndex that I increment each time. That variable provides a link to the other data table by giving me the position of the current and allows me to get the URL for the given row.

URL Index

That's one solution.

Alternatively, you could pull back all columns between AD and AG and then simply reference the column on each row as you loop around.

Skin
  • 9,085
  • 2
  • 13
  • 29