Jump 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.

How to use getField() with related table fields...???

Featured Replies

I've got a table called Products and another table called Scans that are related by a field called ScanID. Via the FM PHP API, I'm connecting to a layout in the Scans table.

When I use getField('ScanID') that works great because the field actually resides in Scans. However, I also have fields on this layout from the related Products table (ie. Products::ItemNumber) However, when I try that with getField('Products::ItemNumber') I get nothing back. Simply blank values.

I'm also not getting any errors back when calling getField() on these fields.

Any information on what I'm doing wrong would be greatly appreciated. Thanks!

An empty portal won't give anything, and if you try to address fields on a different TOG's layout will no ties let you see it. Perspective is obviously the layout and record from where the command is issued, and it picks the first related record only, and if it happens to be empty - shrug!

--sd

  • Author

I'm not dealing with a portal. This is just a field in a layout from a related table. When I work with the XML API myself instead of using the PHP API I can use TableName::FieldName to grab data from the layout without any problems.

Is the key value on primary side of it an unstored field?

--sd

  • Author

Well, like usual, this was a case of me being an idiot. It just so happens that this record I'm working is one of the very few where this value that's coming back blank...actually is blank in FM!

When I work with a good complete record (like I should be!) everything works great.

Sorry for the bad post.

  • 5 years later...
  • Newbies

Hi,

 

I am having the same problem for my CNS Audit Table.  I have set a field (in the CNS Audit Table) to equal getField ( "DataTable::Field").  No error message results but the field is empty.  There is a string value  in the field being fetched from.  The two tables are related.  I can also fetch the data from the same field in another related field.  I was wondering why I cannot getField into the CNS Audit Table.  Could some please help?

 

Thanks.

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.