×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Dexterity Techniques

Using Table_SetCreateMode and Table_SetDeleteOptions by winthropdc
Posted: 5 Jul 05 (Edited 15 Nov 05)

Using Table_SetCreateMode and Table_SetDeleteOptions
====================================================

The function library command Table_SetCreateMode() is used to control how Dexterity handles missing tables.  If it is set to true, the table is automatically created by Dexterity if it is not found. Otherwise, if set to false Dexterity will not create the table.

The function library command Table_SetDeleteOptions() is used to control how Dexterity handles deleting tables.  If it is set to true, the table is physically removed. Otherwise, if set to false Dexterity will leave the table intact but remove its contents.

The Great Plains code sets the appropriate value for these settings during its initialisation.  However, the values depend on the platform being used.

On a MS-SQL based platform, the default values should be set to Table_SetCreateMode(false) and Table_SetDeleteOptions(false).  This is because only the Database Owner or System Administrator users have the rights to create a new table. In a SQL System all tables (with associated stored procedures) are created during the installation process and access granted to them to allow use by all users.  Consequently, physically removing the table will cause problems as it will not be recreated when it is needed.

So, when using these two commands it is vitally important to restore the setting to the default state for the platform.  This is because other code within the system is expecting these states to be correct and it may cause problems elsewhere in the application if the mode is left in the incorrect state.  In the two examples below, the state is restored after the specific actions have occurred.


{ Create Table Example }

if 'SQL Server' of globals > 0 then
    Table_SetCreateMode(true);
end if;

{ Create Tables Here, LAN settings are already correct }

if 'SQL Server' of globals > 0 then
    Table_SetCreateMode(false);
end if;


{ Delete Table Example }

if 'SQL Server' of globals > 0 then
    Table_SetDeleteOptions(true)
end if;

{ Physically Remove Tables Here, LAN settings are already correct }


if 'SQL Server' of globals > 0 then
    Table_SetDeleteOptions(false)
end if;


Below are summaries of the Table_SetCreateMode() and Table_SetDeleteOptions() function library commands from the Dexterity Help file.


Table_SetCreateMode()
---------------------

The Table_SetCreateMode() function allows you to choose whether tables that donÆt already exist will be created automatically when they are accessed at runtime.

Syntax:
    Table_SetCreateMode(option)

Parameters:
    option û A boolean that sets the table creation mode:
        true    - Automatically creates the table if it isnÆt found.
        false    - DoesnÆt create the table if it isnÆt found.

Return value:
    The boolean value true.


Table_SetDeleteOptions()
------------------------

The Table_SetDeleteOptions() function allows you to choose whether a delete all or drop will be executed when the delete table statement is used.

Syntax:
    Table_SetDeleteOptions(option)

Parameters
    option û A boolean that sets the delete table functionality:
        true    - Use the drop functionality, which removes the data and the table from the database.
              This also removes the auto-generated stored procedures for the table.
         false    - Use the delete all functionality, which removes all of the data in the table,
              leaving the empty table intact in the database.

Return value:
    The boolean value true.


David Musgrave [MSFT]
Senior Development Consultant
MBS Services - Asia Pacific

Microsoft Business Solutions
http://www.microsoft.com/BusinessSolutions

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.  

Back to Microsoft: Dynamics GP (Great Plains) FAQ Index
Back to Microsoft: Dynamics GP (Great Plains) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close