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 "Get ( TableName )" for each table

Featured Replies

I would like to add a particular "meta-data" field to each table in my solution. I want this field to calculate and display the table name. I read a little on the functions "TableNames" and "TableIDs" but from what I understand they will return a list of ALL table names or ALL table IDs used in the file.

Since there is no "Get ( TableName )" function that I can see, how does one go about using either "TableNames" or "TableIDs" to return just the table name I am trying to get?

I would like to do the same with Layout names as well - so if there is a solution - I imagine the same logic would apply.

Much appreciated if you can help.

there is no "Get ( TableName )" function that I can see

Have a look at the Get(LayoutTableName) function. Note that "table" here actually means "table occurrence".

I would like to do the same with Layout names as well

See Get(LayoutName).

  • Author

Thanks Comment for the reply. Well, as usual, things are more complicated than I hoped for.

The problems:

I want each table to have one field that contains its table name. If I use "Get ( LayoutTableName )" it gives me the Table Occurrence Name - which can be different than the table name. I can hard code - but I want something dynamic / automatic.

Ironically, I would also like to use the "Get ( LayoutTableName )" to display the TO that portals are coming from - but that doesn't work because they are coming from TOs other than the layout the TOs are based on.

In short, I am trying to automate - and document - the solution. Also, facilitate the display of table names, TO names, layout names, etc. I want to prevent hard coding as much as possible. I recall some time ago wanting to use layout names in parameters but they had to be hard coded instead of referencing a field.

SInce one table can feed many TOs and many layouts - I understand why it is not easy. I imagine there has to be some parsing of a list to pin-point where and what something is.

Is there any way to capture the actual table name (not the TO) via a calculation?

Thanks in advance!

Is there any way to capture the actual table name (not the TO) via a calculation?

Not that I know of.

IMHO, you're just creating extra work for yourself. For example, a portal already shows the source TO when you enter Layout mode.

  • Author

Remember Comment - I am obssessive-compulsive.

I am using it for display purposes - not developer purposes. I do this with layout names and it saves me work - and I do not have to worry that a layout name has changed - but the display title for the layout has not changed. I have found several uses for this type of "convention" that serves me well.

I would like to do this for fields as well.

Thanks for the help again.

  • 2 years later...
  • Newbies

Let (

[

x = GetFieldName (Self) ;

count = Length (x) ;

remove = 9 ; // This number should be the length of your fieldname plus 2. Mine field is "table_C" so the value is 9. ("::table_C")

return = Left ( x ; ( count - remove ) )

]

; return )

Try this custom function (I also uploaded it to the Brian Dunning Filemaker Pro Custom function website)


//  SYNTAX:   ListBaseTableName

//   ORIGIN:   http://www.decisiongroup.net

//    NOTES:    Returns the base table name based on the table occurance on a particular layout in the current FileMaker Pro v12 file

//	 VERSION:   1.0v1 - for FileMaker Pro v12

//	  © 2012 Lazarus Sismanis, Decision Group Inc., Eagleville, PA, USA

// requires FileMaker Pro v12 or higher

//Thanks to  Andrew Duncan, Databuzz, Sydney, Australia for his ListBaseTables function

ExecuteSQL ( "SELECT DISTINCT BaseTableName FROM FileMaker_Tables WHERE TableName='" & TableOccurrenceName & "'" ; "" ; ""  )

To get the CF posted by lazarus to work, you will need to use this in the calculation definition for the field:

(this calculation hasn't been tested, but I think it will work)




ListBaseTableName(

    GetValue(

        Substitute(

            GetFieldName( self ) ;

            "::" ; ¶

        ) ;

        1

    )

)

...but that's only going to work in FM12. Of course, you could use an SQL plug-in to make that Custom Function work in versions prior to 12.

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.