hclleapforum

Open full view…

Retrieve attachment info from table to place into attachment field

jonathanmorseusb
Thu, 01 Aug 2019 17:36:51 GMT

I have a table of attachments where I want to do a looping service to check the table for certain attachment types (types being an arbitrary drop down to indicate file type) and then add that attachment to a real attachment field to be able to include on an e-mail. Any suggestions on approaches that I could pursue?

christopher_dawes
Fri, 23 Aug 2019 18:47:49 GMT

Is the attachment field on the same form? I suspect it is a hidden control that you are using. You should be able to just set the value of the attachment widget outside the table to the same value as the one you retrieve from inside the table.

jonathanmorseusb
Wed, 28 Aug 2019 12:55:03 GMT

I am using the following. Problem is it is placing the same attachment in all 10 fields. var tbl = BO.F_Table9; var row = 0; for(var i=0; i<tbl.getLength(); i++){ var result1 = tbl.get(i).F_CheckBox5.getValue(true); if (result1 === true){ var row = i; } var foundrow = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow); var selected = form.getPage('P_NewPage1').F_Table9.getSelection(); var o = null; //object o = selected.F_Attachment1.getValue(); BO.F_Attachment3.setValue(o); break;} // var tbl2 = BO.F_Table9; var row2 = 0; for(var i2=0; i2<tbl2.getLength(); i2++){ var result2 = tbl2.get(i2).F_CheckBox5.getValue(true); if (result2 === true){ var row2 = i2; } var foundrow2 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row2); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow2); var selected2 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o2 = null; //object o2 = selected2.F_Attachment1.getValue(); BO.F_Attachment4.setValue(o2); break;} // var tbl3 = BO.F_Table9; var row3 = 0; for(var i3=0; i3<tbl3.getLength(); i3++){ var result3 = tbl3.get(i3).F_CheckBox5.getValue(true); if (result3 === true){ var row3 = i3; } var foundrow3 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row3); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow3); var selected3 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o3 = null; //object o3 = selected3.F_Attachment1.getValue(); BO.F_Attachment5.setValue(o3); break;} // var tbl4 = BO.F_Table9; var row4 = 0; for(var i4=0; i4<tbl4.getLength(); i4++){ var result4 = tbl4.get(i4).F_CheckBox5.getValue(true); if (result4 === true){ var row4 = i4; } var foundrow4 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row4); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow4); var selected4 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o4 = null; //object o4 = selected4.F_Attachment1.getValue(); BO.F_Attachment6.setValue(o4); break;} // var tbl5 = BO.F_Table9; var row5 = 0; for(var i5=0; i5<tbl3.getLength(); i5++){ var result5 = tbl.get(i5).F_CheckBox5.getValue(true); if (result5 === true){ var row5 = i5; } var foundrow5 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row5); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow5); var selected5 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o5 = null; //object o5 = selected5.F_Attachment1.getValue(); BO.F_Attachment7.setValue(o5); break;} // var tbl6 = BO.F_Table9; var row6 = 0; for(var i6=0; i6<tbl3.getLength(); i6++){ var result6 = tbl.get(i6).F_CheckBox5.getValue(true); if (result6 === true){ var row6 = i6; } var foundrow6 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row6); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow6); var selected6 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o6 = null; //object o6 = selected6.F_Attachment1.getValue(); BO.F_Attachment8.setValue(o6); break;} // var tbl7 = BO.F_Table9; var row7 = 0; for(var i7=0; i7<tbl3.getLength(); i7++){ var result7 = tbl.get(i7).F_CheckBox5.getValue(true); if (result7 === true){ var row7 = i7; } var foundrow7 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row7); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow7); var selected7 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o7 = null; //object o7 = selected7.F_Attachment1.getValue(); BO.F_Attachment9.setValue(o7); break;} // var tbl8 = BO.F_Table9; var row8 = 0; for(var i8=0; i8<tbl3.getLength(); i8++){ var result8 = tbl.get(i8).F_CheckBox5.getValue(true); if (result8 === true){ var row8 = i8; } var foundrow8 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row8); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow8); var selected8 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o = null; //object o8 = selected8.F_Attachment1.getValue(); BO.F_Attachment10.setValue(o8); break;} // var tbl9 = BO.F_Table9; var row9 = 0; for(var i9=0; i9<tbl3.getLength(); i9++){ var result9 = tbl.get(i9).F_CheckBox5.getValue(true); if (result9 === true){ var row9 = i9; } var foundrow9 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row9); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow9); var selected9 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o9 = null; //object o9 = selected9.F_Attachment1.getValue(); BO.F_Attachment11.setValue(o9); break;} // var tbl10 = BO.F_Table9; var row19 = 0; for(var i10=0; i10<tbl3.getLength(); i10++){ var result10 = tbl.get(i).F_CheckBox5.getValue(true); if (result10 === true){ var row10 = i; } var foundrow10 = form.getPage('P_NewPage1').F_Table9.getBOAttr().get(row10); form.getPage('P_NewPage1').F_Table9.setSelection(foundrow); var selected10 = form.getPage('P_NewPage1').F_Table9.getSelection(); var o10 = null; //object o10 = selected.F_Attachment1.getValue(); BO.F_Attachment12.setValue(o10); break;}