Skip to main content
Microsoft Dynamics GP forum
Answered

Table_SetCreateMode ... isn't? ... working?

editSubscribe (0) ShareShare
ReportReport
Posted on by 290

Hey All:

As an extension of a previous question, unrelated to the first from the outside, I've created a new question.

My specific problem is that I have a situation like this:

Table_SetCreateMode(true);
get first table my_table;

The table doesn't exist in my system and Dexterity *is not building it*. It builds other tables in the script around it, but it simply will not build this one.  The code continues on with no reference to trying to build the table, then blows its brains out later trying to read a table that it - for some reason - failed to create.

Oh, and I know about Table_DisableSQLErrors() [or whatever it is, I haven't looked it up for this post] that disables SQL errors, but if that is required to be set - why does it operate correctly for other tables in the same script?

Has anyone come across something like this?

Thanks.

-J

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,781 Super User on at
    RE: Table_SetCreateMode ... isn't? ... working?

    Hi James

    You should be making sure that all your tables are created after login.  

    I usually turn off errors and get first on each time to confirm the table exists and has the correct structure.  I ignore the expected errors of EOF and OKAY for table empty or table has data.

    If a table fails, I will check if I have sysadmin status. If no, I display an error message and stop my code.

    If yes, I will create all the tables by changing the create mode and getting first again.

    Once I know the tables are created, I set a global variable to true.

    All my windows and triggers will then check that global variable and only work if it is set to true.

    Regards

    David

    PS: I also have code that will automatically upgrade table structures if the table exists but still has read errors.

  • James McCullough Profile Picture
    James McCullough 290 on at
    RE: Table_SetCreateMode ... isn't? ... working?

    To anyone who is following along on this I found something out about Dexterity that I don't recall ever having read before.  It may be intuitive but it took me a minute.

    The Table_SetCreateMode(true) command will only create a table if you haven't assigned a value to the table buffer.

    What I mean is, before I called the table the first time, I'd set a key value in the table buffer, then tried calling the table.  Because Dexterity (SanScript) already had a value in the buffer, when it couldn't find the table it freaked out.

    Lesson: check your tables with clear buffers when trying to create them.

    Thanks everyone!

    -J

  • RE: Table_SetCreateMode ... isn't? ... working?

    Hello James,

    That is odd!

    It sounds like it is creating other tables, just not this specific one. Is that the case?

    Is there anything unique about what you are trying to do with this table?

    Is this table named something that could be blocked (like a system table name)?

    I know we have quite a few community members who are quite good with Dexterity, so I am sure we can figure this out.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,030 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans