Reference table data in script

Hello,

I have a situation where I have a complex function (such as changing a Letter grade to a GPA) in a auto-filled table. Doing this with built-in steps would be cumbersome. I am able to reference the Table Data, but I am not able to find a way to reference the current row number dynamically within the script. Is there a certain way to reference this?

For example this would give me the 1st or 0 row in a table for the GPA key: tableName[0].GPA.

The '0' is where the dynamic reference to the current row number should be.
 

Tags Data table reference script row
Asked by Michael Leys on Wed 3/20/24 2:23 PM Last edited Wed 3/20/24 2:23 PM
Sign In to leave feedback or contribute an answer

Answers (2)

This answer has been marked as the accepted answer
Mark Sayers Wed 3/20/24 2:58 PM

Hello Michael,

I assume you are attempting this in an iPaaS flow, yes?

Can you provide the name of the flow you're attempting this in? and from which step of the flow?

Sincerely,
Mark Sayers
Sr Support Consultant, CS

No feedback
This would be the ' Load NRCCUAAOS' flow, currently in Salesforce - Dev Application. Inside the group 'mappedPayload' is where I would like to use it inside the Gpa__c field, which references the GPA field from the auto-filled table.
(currently the script is in the design clipboard)
- Michael Leys Wed 3/20/24 3:11 PM
Hi Michael, In the first line of the script, change 'lead' to lead-1.

const letterGrade = fileData_NRCCUAAOS[lead-1].GPA;

lead is the variable of the for loop starting at 1. Need to subtract 1 as jscript starts indexing at 0
- Mark Sayers Thu 3/21/24 9:14 AM
Excellent! I am not sure how I did not try that. Thank you! - Michael Leys Thu 3/21/24 9:40 AM

David Tod Wed 3/20/24 2:58 PM

Can you put the current row number into a flow variable, and then use that?

No feedback
I have tried this, but there is some kind of bug or sync error when referencing a set property from a previous step. It will error that the variable is not yet set. - Michael Leys Wed 3/20/24 3:11 PM