January 19, 200521 yr Hope you all are doing well. I just have a quick question related to the portal relationship: I have two related tables (Reference and Author) and the name of the relationship is "Authors" and I have a portal on the Reference layout which shows some fields from the Author table !! Now my question is I am trying to add a new record into the Reference table and at the same time I want to add the corresponding authors into the Authors table too by using that portal ...so I am trying to write my query string something like: $create->AddDBParam('Authors::Author.1',$_POST['Author1']); OR something like this (if I want to add multiple records): for($i=1;$i<=$authornumber;$i++){ $create->AddDBParam('Authors::Author.'.[$i-1],$_POST['Author'.$i]); } but it doesn't work give me an error#101 : Does anyone has anyideato solve this problem?? I would really appreciate for any help !! Hope to hear from you guys soon. Thanks a lot. Sincerely, Ankur
January 19, 200521 yr Try this: $create->AddDBParam('Authors::Author.0',$_POST['Author1']); A ".0" is required to add a row. Any other numbers will "edit" the row. Good Luck. Garry
January 20, 200521 yr Author Thanks for the reply Garry !! I really appreciated it, it works great only if I just want to add one row !! But again it gives me same error (#101), if I want to add more then one row/record to a portal. For first row, I tried: (it works fine) $create->AddDBParam('Authors::Author.0',$_POST['Author1']); So I thought may be for second row, I should try someting like: $create->AddDBParam('Authors::Author.1',$_POST['Author1']); but it doesn't work !! may be because as you said "Any other numbers will edit the row", So I was just wondering if you have any other idea to add multiple records through portal ?? Thanks for your time and help. Sincerely, ankur
January 20, 200521 yr The only way is to loop through the "edit/new" the required number of times. All the best. Garry
January 20, 200521 yr Author Thanks again !! Actually I tried in the loop too: ex1: $create->AddDBParam('Taxon',$Taxon); $create->AddDBParam('PdfName',$PdfName); $create->AddDBParam('pdftextsearch',$pdftextsearch); $create->AddDBParam('URL',$URL); for($i=1;$i<=$authornumber;$i++){ $create->AddDBParam('Authors::Author.'.($i-1),$_POST['Author'.$i]); } $createResult=$create->FMNew(); but it didn't work !! So I tried to fix "Authors::Author.0" and I wrote something like: ex2: for($i=1;$i<=$authornumber;$i++){ $create->AddDBParam('Authors::Author.0',$_POST['Author'.$i]); } I got an interesting result, I didn't get any error but all the authors values came into the first row(first record) with a line break !! rather than creating a new record for the second author and onwards Do you know, how can we create a new record (more than one) through portal in a relationship ?? Any idea or help would be greatly appreciated !! Thanks guys Sincerely, Ankur PS: please see the attched file, Thanks !! Picture6.pdf
January 20, 200521 yr The loop should encompass the "FMNew()" or "FMEdit()" methods! The portal row will always be ".0" to create a new row. Garry
Create an account or sign in to comment