Avatar

Level 7

I have a form where there are multiple intstances of tableRows inside a Repeating Subform.

Subform[*]

     ..TableRow[*]

I want to devise a way to round up all the information contained in fields in the TableRows and populate other fields with some of that data, in a different subform, in a different part of the form.

I want to populate the fields by clicking on a button and with each click, a different record set populates the fields. So the user is in effect, scrolling through the possibilities, and the user stops clicking when they see the record set they want to use populating the fields. It is very unlikely that there will be more than 5 or 6 records, and more likely it will be 2 or 3 record sets (clicks). This just eliminates the user from having to re-enter data that will be located in a different part of the form.

I have written JavaScript and FormCalc scripts that don't function according to plan. I am getting the following:

Error: missing or illegal parameter(s)

////////////////////////////////////ALL ON THE CLICK EVENT OF A BUTTON'

var RVdetails
var yearTxt       =    ""
var makeTxt    =    ""
var modelTxt    =    ""
var engineTxt   =    ""
var SerNoTxt    =    ""
var k = 0

//with each click of the button

//for each of the subforms
//for each line in each subform

//using the 5 textfields in the

//build a multi-demensional array using k as the 1st index

var IMsubforms    =    SubformPropCoverages.SubformInlandMarine[*]

     for i = 0 upto Count(IMsubforms) step 1 do
          var IMsubFields    =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[*]   
               for j = 0 upto Count(IMsubFields) step 1 do
                    yearTxt            =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[j].TxtYear 

                    makeTxt          =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[j].TxtMake

                    modelTxt         =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[j].TxtModel

                    engineTxt        =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[j].TxtEngine

                    SerNoTxt         =    SubformPropCoverages.SubformInlandMarine[i].SubformRVDesc.TableRVDetails.RowRVDetails[j].TxtSerialNum

                    RVdetails[k]    =    Ref(yearTxt,makeTxt,modelTxt,engineTxt,SerNoTxt)                                                 

                    k = k + 1
                    continue

               endfor

               continue 

          endfor

//also  with each click of the button, using the global variable to keep  track of where you're at between clicks,

//step through the array and fill these fields in the same row as the  button

//with values from the array

//the user stops clicking when they see the fields populated with the  values they are looking for

        if    (clickRV.value < k )    then
            TxtYear                 = RVdetails[clickRV.value][0]
            TxtMake                = RVdetails[clickRV.value][1]
            TxtModel               = RVdetails[clickRV.value][2]
            TxtEngine              = RVdetails[clickRV.value][3]
            TxtSerialNum         = RVdetails[clickRV.value][4]
            clickRV.value         = clickRV.value + 1
        else                                           
            clickRV.value         = "0"  //the global resets to 0 when it reaches the max k
            TxtYear                 = ""
            TxtMake               = ""
            TxtModel              = ""
            TxtEngine             = ""
            TxtSerialNum         = ""
        endif

/////////////////////////////////////////////////////////////////////////////////

Any and all advice is very much appreciated!

Thanks,

Stephen