Hello,
I need help understanding the use of getValuebyKey(). In this custom code, I iterate through each of the rows to extract the content of the second column and then process that string. This table is imported from a database, so it comes with a default ID column. If the ID starts at 1 and increases progressively, the function works for me. But this table can depend on certain SQL filters that change that ID.
As I have it set up, Table("BD_CPLAB").getValueByKey(row, 4) or Table("BD_CPLAB").getValueByKey(row, 2), as seen in the following capture. Row is an int that takes its value from the total number of rows in the BD_CPLAB table, to iterate through all the rows.
In the Systems Console, I get several errors referring to the same thing because I have this function in other Custom Code of my PF. The curious thing is that it points to row 36, where there is no error as I have checked.
To solve it, I changed the expression to Table("BD_CPLAB")[row] or Table("BD_CPLAB")[row]. What I intended with the getValuebyKey() function is that with the first argument of the function, it would go to the row index (1, 2, or x) and point to the column I indicate…
but what I have found is that it looks for a value equal to row in one of the rows?
I have two questions:
Can I use the getValuebyKey() function with this approach? How could I call the row index where the if condition is met?
Why is it pointing to an incorrect row in the System Console?