Open Forum

Expand all | Collapse all

Table Trigger doesn't Appear in C# Project

  • 1.  Table Trigger doesn't Appear in C# Project

    Posted Jul 07, 2020 06:46 PM
    I have a table trigger for deleting records from a custom table any time an order is deleted from the SOP Entry window. I am trying to extend the functionality of this using an event handler in C#. However, the trigger is not available from C#. I have verified that the trigger works from Dexterity and am using DAG to create an assembly from the dictionary. But even after adding it as a reference to the project, the trigger doesn't show up anywhere.

    I have created other custom update triggers that do appear in our C# project and have been able to create events off of them that work as intended. I even tried to change the trigger to be an update instead of a delete to see if that made a difference but it still didn't show up after I recompiled the assembly. Any advice?

    Thanks in advance.

    ------------------------------
    Jacob Fawcett
    WatchGuard Technologies
    Seattle WA
    ------------------------------
    Academy - Online Interactive Learning from Experts


  • 2.  RE: Table Trigger doesn't Appear in C# Project

    GPUG ALL STAR
    Posted Jul 08, 2020 01:38 AM
    Hi Jacob

    I am trying to understand exactly what you are doing.

    Are you creating a Dexterity Database trigger which calls a Dexterity Global Procedure which in turn is a place holder for you to add C# code?

    The Dexterity Global Procedure fires but you cannot see it from C# after DAGging?

    It is possible that the parameters for the Global Procedure usually the inout table <Table> and in integer IN_Operation contain a datatype that is not supported by .Net.  In which case the procedure would not be exposed.

    I would recommend creating a global function which just as the table key fields and anything else you might need as parameters.  Then call this function from the Trigger handler global procedure.  Once DAGged you should be able to register a C# event on the global function and have the parameters you need to finish your code.

    Hope this helps.

    Regards

    David

    PS: you could just write it all in Dexterity. :)

    ------------------------------
    David Musgrave MVP, GPUG All-Star

    Managing Director
    Winthrop Development Consultants

    Perth, Western Australia

    http://www.winthropdc.com
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 3.  RE: Table Trigger doesn't Appear in C# Project

    Posted 20 days ago
    Sorry, I've been meaning to circle back and respond to this. Yes, you are correct in your understanding of the issue. I worked with another developer who has more Dexterity knowledge than me and we were able to figure out why the procedure wasn't working.

    1. As you suggested, we took a closer look at the input parameters to the procedure. One of the input parameters was an anonymous table and it appears that .Net does not recognize the anonymous identifier and thus was not including the procedure when compiling the assembly. Removing that and recreating the assembly got it to show up in Visual Studio, but the trigger was still not firing for me.
    2. We eventually discovered that there were multiple ways to accomplish the task that we were trying to modify and I was doing it a different way than the other developer. His way was using the trigger we were trying to modify, whereas my way was using a different trigger, so no amount of modification was working for me. Once we figured that out, we were able to get things working for both triggers.

    Thanks for your help on this. We have run into multiple issues similar to this for the past year or so and have had to find different workarounds so this was very insightful to help with future work with table triggers and procedures between Dexterity and .Net.

    ------------------------------
    Jacob Fawcett
    WatchGuard Technologies
    Seattle WA
    ------------------------------

    Academy - Online Interactive Learning from Experts


If you've found this thread useful, dive deeper into User Group community content by role