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.

FMNew() - no values returned when record created

Featured Replies

Hi, I am trying to add a new record to FM 7 using FX. The new record is added; however, the returned data set has no data. It is supposed to have the values of the just created record. Here is my code:

$result=$NewData->FMNew();

$recKey = key($result['data']);

$recordPointers = explode (".",$recKey);

$recID = $recordPointers[0];

RecID is null.

Any ideas will be very appreciated! Thank you very much

Try to print the Array to see if it is anywhere else:

print_r($result);

Good Luck.

Garry

  • Author

That what it looks like:

fx_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024

 => 100 [message] => FX: ExecuteQuery XML error: no element found at line 1 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 879 [function] => fx_error [class] => fx_error [type] => -> [args] => Array ( [0] => ExecuteQuery XML error: no element found at line 1 ) ) [1] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 1041 [function] => executequery [class] => fx [type] => -> [args] => Array ( [0] => -new ) ) [2] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 1107 [function] => fmaction [class] => fx [type] => -> [args] => Array ( [0] => -new [1] => 1 [2] => full ) ) [3] => Array ( [file] => /Library/WebServer/Documents/SSD_new/new_ticket.php [line] => 34 [function] => fmnew [class] => fx [type] => -> [args] => Array ( ) ) ) [callback] => ) 

Does it tell you about anything?

Thank you very much for your help!

Here is what a basic - create a new record should look like:

$newrecord=new FX($serverIP,$webCompanionPort);

$newrecord->SetDBData('Order.fp5','ForWeb');

$newrecord->AddDBparam('OrderID', '');

$newrecordResult=$newrecord->FMNew();

foreach($newrecordResult['data'] as $key=>$newrecordData);

$recordDetails = explode('.',$key);

$currentrecord=$recordDetails[0];

Then I might set a cookie:

setcookie("orderID", $currentrecord, time()+60*60*24,"/");

This could also be done with sessions.

Hope this helps - but also consider FXForge from the people at FMWebschool (FXforge.net)

  • Author

I am working with FM 7. Anyways - tried that. It looks like it does not return data only if I am using particular layouts. If I use layout that contain ONLY fields from this database - it returns data. If I use layout that contains fields from related db's - it does not. User names and passwords are identical for all the related databases. Also, if the record is being created - I can't see it via FMPXMLRESULT link using layouts other than the one that was used to create it. I've spent so much time trying to figure this out and I am getting really frustrated...:

Please help....

having not seen your whole code, can't check to see what you might have missed. I just went through a similar problem and was missing:

$newrecord->SetDBPassword($db_password); //$db_password is defined in fx_server.php

The other steps - which you have have done - are to reduce the number of fields you are trying to create in the new record and see if you can get one field to work.

Also looking at your array you printed, there appear to be some files missing or errors in your coding. Check line 34 of new_ticket.php

If you are having huge frustrations, I'm sure there are many coding experts that for an hours worth of billable time could review in detail your files and make the corrections necessary.

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.