Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

Using Triggers

Integrated Application Platform › Forums › General › Using Triggers

  • This topic has 5 replies, 2 voices, and was last updated 5 years, 3 months ago by ajith.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • October 13, 2017 at 3:05 am #1336
    ajith
    Participant

    Hi,

    I am trying to use Triggers for the first time.

    I have a table named hmEmployees for which I have defined a trigger by naming an item in the same library as Trigger_hmEmployees . I wanted the trigger to insert part of the info from the table into another table, which was not working. So, I changed the code to

    function(transaction, oldrecord, newrecord)
    	{
    	Inspect(newrecord)
    }

    Whether I output a new record, delete a record or modify an existing record in the table hmEmployees through an Access, the Inspect(newrecord) doesn’t get called.

    What is it that I am doing wrong?
    Thanks,
    ajith

    October 13, 2017 at 8:44 am #1337
    j_ferguson
    Moderator

    Hi Ajith,

    I tried the same thing on my copy and it worked even when I was using AccessControl to insert records. My table is a very simple table and I am running suneido.exe standalone.

    If you are running client-server, the trigger will be executing on the server side and the Inspect will not work as expected. In that case you could try using SuneidoLog, or writing to a file instead to debug your trigger.

    If you are running Suneido standalone, it is possible there is something about your table that is different from the simple one that I set up. Again, writing to a file (you can use the AddFile function for that), or SuneidoLog would be a better option for debugging than using Inspect in your trigger.

    I hope this helps you figure it out. If not, with a little more information we should be able to sort it out.

    October 13, 2017 at 8:53 am #1338
    j_ferguson
    Moderator

    I also forgot to mention that if you are running client-server and you modify a trigger function, you may have to unload that trigger code on the server so that it re-loads your new code:

    ServerEval(‘Unload’, ‘Trigger_tmEmployees’)

    Or, you can use a brute-force method of restarting the Suneido server, that works too.

    October 13, 2017 at 9:33 pm #1339
    ajith
    Participant

    Hi Jeff,

    Thanks to your reply. Great to hear from you after a long time.

    I deleted my table and re-created it and the trigger is getting called. But, it is not working as expected, instead it is giving an error. I will look into that error and get back if I need your help.

    I noticed that the trigger doesn’t get called if the the library entry for the trigger is made after the table is constructed. I checked it twice by deleting the table and re-creating it and got the same pattern. I am running Suneido as standalone. My table has a details table linked to it and has two keys, one of which is a compound key from three columns.

    Thanks,
    ajith

    October 16, 2017 at 9:19 am #1340
    j_ferguson
    Moderator

    Hi Ajith,

    It shouldn’t matter when the trigger definition is created. I wonder if there is an error or exception happening that you are not noticing? If this continues to be a problem, you might consider attaching an export of your trigger definition as well a dump of the table the trigger is on.

    Thanks.

    October 17, 2017 at 9:28 pm #1341
    ajith
    Participant

    Hi Jeff,

    Thanks for your reply. May be I missed some error as you say. Except for the initial trouble I had which was solved by re-defining the table, it is working as I wanted.
    Thanks,
    ajith

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language