Design Studio Select Line Solution

Do you need to determine the line you're working on based upon the user selecting it in the Line FC? Here's a simple method I used with AP95.2 to pass variables to ImageNow to display an invoice. I had to repeat this for each line of the form.

This is using the field ID's.

if (lawForm.getElementValue("_f36r0") =="X") // Line 1
{
Vendor = lawForm.getElementValue("_f39r0")
Invoice = lawForm.getElementValue("_f41r0")
DisplayImageWeb()
}
if (lawForm.getElementValue("_f36r1") =="X") // Line 2
{
Vendor = lawForm.getElementValue("_f39r1")
Invoice = lawForm.getElementValue("_f41r1")
DisplayImageWeb()
}