Ticket #30112
I have a new stored procedure that runs at *AFTERADD where I pass it the OEETransID (which is an Identity Field). The value for OEETransID is always 0 instead of what the real OEETransID is. Any Ideas?
What you are seeing is to be expected behavior when in add mode trying to pass an identity column value to a procedure. When m-Power goes to write your INSERT statement upon the record being first added, we have to omit the value for the identity field that way your SQL server can handle this. Therefore when the application immediately goes to call the procedure (at *AFTERADD) after performing the INSERT, m-Power does not know what the identity value is to send to your proc because it was never passed from the form when inputting data. If you must use an identity type field in the table your maintainer is built over, you could alter your SQL procedure to basically select the max identity value from the table and store it into a variable, and then pass this variable to whatever proceeding logic your SQL procedure contains This would be an easy option to ensure you have the identity value before you performing any steps in the procedure.
Asked on March 12, 2020