Keep Column with numerical range as column name

Hi I’m trying to create a lookup where rates are driven for a vendor by the number of days the service was provided,

Rates are in a table where column names would be [“Vendor”,“Day 1-7”,“Day 8-14”,“Day 15-21”] etc.

How would I be able to get the value if the number of days = 13 for example?

Hi @Hutch

Try like below

vendor = "Vendor A"
days = 13

If days <= 7 Then
    columnName = "Day 1-7"
ElseIf days <= 14 Then
    columnName = "Day 8-14"
ElseIf days <= 21 Then
    columnName = "Day 15-21"
Else
    columnName = "Other" ' Adjust for additional ranges
End If

rate = ratesDataTable.AsEnumerable().
           Where(Function(row) row("Vendor").ToString() = vendor).
           Select(Function(row) row(columnName).ToString()).FirstOrDefault()

Regards,

You can add this lookup in modern activity also
And while adding lookup activity you can have conditions as per below response and inside there add lookup activity to get exact. Value you want

1 Like