December 13, 200520 yr Hi I need a little more help and hope someone have an idea. I would like to send all information from a layout in a mail. However the layout include a portal and I can only get the first line added to the mail. This option could be a calculation made in the Send Mail or Send Event option but I was thinking that maybe the best way is to make a script that show the information in a Global field that I then can add to the mail body. My problem is getting all the lines (5 fields and unknown number of lines) in the portal in the global field. Do anyone have an idea for me to try? Thanks for any help on this. Cheers Jens Peter
December 13, 200520 yr I would write a script that either loops through each portal row, setting the global field to the contents of each portal row before going to the next portal row, or that uses the new GetNthRecord function to essentially do the same thing without requiring you to loop through each portal row which requires that the portal be readily available.
December 13, 200520 yr I would have a subscript go to the related records in the portal and step through them, appending the data from each child record to the global field. I posted this as the above response was being posted, and ended up second. But I agree with the get nth record approach. That's a good way to go. Edited December 13, 200520 yr by Guest
December 13, 200520 yr Author Hi Lwlgeorge and Ross Sounds like the GetNthRecord could be nice to use but my problem is to get it to work. Even the loop thing I am not so sure about. I have an ID that links to the data in the portal. How would I get the script to loop or use the GetNthRecord correctly. I have tried a number of codes but all I get is the first record in the portal. Any help is much appreciated. /Jens Peter
December 13, 200520 yr Something like this should work: Set Variable[$count_PortalRecords; Value: Count(Related::ID)] Set Variable[$counter; Value: 1] Loop Set Field[global_Field; global_Field & GetNthRecord(Related::Field1; $counter)] Set Variable[$counter; Value: $counter + 1] Exit Loop If[$counter > $count_PortalRecords] End Loop
December 13, 200520 yr Author Hi Lwlgeorge Thank you so much. I have made the script and it now add all the records in the portal by the first field. Except it start the line with a ? For the other 4 fieds I have then added also but for each line I add there are also added one extra ? at the start of the global field. I have added the extra fields the Set Field (global_field: global_field & GetNthRecord ( Related::field1;$counter) & " " & GetNthRecord ( Related::field2;$counter) and so on... Why are there added these ?? This is great - except for the start ? it work as a dream. Thank you. / Jens Peter
December 13, 200520 yr Author Hi Lwlgeorge Sorry for this - my mistake. In the second Set Variable I forgot to add the Value: 1 When added - no ? Thank you again. Jens Peter
December 13, 200520 yr Your welcome Jens. Glad I could help. Also, glad you figured out the "?" problem.
Create an account or sign in to comment