Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding records through portal by using FX.php

Featured Replies

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

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

  • 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

The only way is to loop through the "edit/new" the required number of times.

All the best.

Garry

  • 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

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

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.