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.

checking out if a table exists

Featured Replies

Hello folks,

is there a way, through a script, to check out if a table exists?

I need to perform some steps only if a table exists but I can't find how to make it works.

Thanks

Maybe, but if the person who writes the script doesn't know if a table exists then something is very wrong.

  • Author

Thanks for your reply.

Could you please let me know how I can check it out?

Not really. I suppose you could use the TableNames() function, but I'm not going to spend time on this. All I wanted to say is that this shouldn't be necessary.

  • Author

Thank you so much for your reply.

Maybe this is not necessary for you but it is necessary for me.

Look forward for someone else's help.

Have a good 1!

Edited by Guest

Can you elaborate more on the logic of your script and why you need to confirm its existence? How often do you run the script and how often is the schema modified where a table is deleted or created?

  • Author

Hi Stephen, sure

basically I'm trying to create a shell for my future development.

and I would like to define a startup script that performs some sub-scripts only if I want those features on that specific database.

So instead removing the sub-scripts themselves, my idea was to delete just the table. For instance let us say I need to log the access to the database. I create a table called accesses and in my startup script I say if accesses exists add a new record on it. So if I don 't want/need this feature what I have to do is remove the table from the specific database instead to modify the startup script itself.

Is there a better way to deal with this issue?

Thanks and have a great evening !!!

" So if I don 't want/need this feature what I have to do is remove the table from the specific database instead to modify the startup script itself."

And when the features need to be added back in again, which method would be easier: re-building the database structure and linking back all the references, or un-commenting out a script step?

Like Vaughan mentioned, I would take the approach of putting the conditional code in to a subscript and only call it if the conditions that this database requires is met, when you add (or remove) the table to the solution un/comment your line in your script or invalidate the condition to the branched subscript.

If you must know if a table exists you could make sure every table has a corresponding layout, putting a text object on the layout with object names give it the name that you want to know like "REQUIRED_TABLE_XYZ" then on startup loop thru each layout in the solution building a list of object names on each layout with GetLayoutObjectAttribute ( ) then parse that list out and determine your branching logic appropriately. That seems like a lot of extra work.

I would rather set a global field on a environment table or set global variable on startup or rather a custom function that defines the solution parameters and branch your script accordingly.

  • Author

thanks guys for your point of view. I appreciate it

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.