We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Adding Data to an Object

kemmy1
Tera Guru

I have an object that looks like this:

 

var fieldMap = {
"form1[0].#subform[0].Pt1Line2a_FamilyName[0]": "3",
"form1[0].#subform[0].Pt1Line2b_GivenName[0]": "3",
"form1[0].#subform[0].Pt1Line2c_MiddleName[0]": "3"
};

 

I want to add these into the object (I have to calculate the x and the y in a function)
"form1[0].#subform[3].Pt9Line3a_PageNumber[0]": x,
"form1[0].#subform[3].Pt9Line3b_PartNumber[0]": y,

 

I know I can do it this way (each calculation has a function)
"form1[0].#subform[3].Pt9Line3a_PageNumber[0]": calculateX(x),
"form1[0].#subform[3].Pt9Line3b_PartNumber[0]": calcuateY(y),

 

Is there a way to push this into an already existing object?  "form1[0].#subform[3].Pt9Line3a_PageNumber[0]": x,

 

Lisa

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, you should be able to update the property like this

fieldMap['form1[0].#subform[0].Pt1Line2c_MiddleName[0]'] = 'z';

 

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, you should be able to update the property like this

fieldMap['form1[0].#subform[0].Pt1Line2c_MiddleName[0]'] = 'z';

 

Thank you.  I swear I had something like that, but obviously my syntax was probably not correct.  Thanks so much!

ricker
Tera Guru

@kemmy1,

Yes you can.  Are you working with arrays of objects? Or just one object?  Can you share an example?