Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi all,
we want to copy some field values from one short text field to another short text field by a trigger. Unfortunately it is actually possible that the string in the source field is longer than the max. length of the destination field. In such a case the user gets an error message, and the transaction will be aborted.
I didn't find any function to get the field size in the trigger documentation. Is there any way to get this information available to a trigger script?
Thanks, Jens
Hello Jens,
there is this Class LocalTriggerManager.ScriptFieldBean
But, I can t find any len or length information, only maxvalue, but this is not what you need.
Looks like the current Bean version is not exposing the length
You may go with a propery file instead where you store the field name and lenght separately, that the trigger can read it from there.
Volker
Hello Volker,
maxValue would be OK for me, but it seems to work only with fields of type INT or FLOAT.
The regarding information seems to be available, at least you can set a max. Textlength via Admin-GUI or CLI, so Integrity can work with it. But unfortunately it isn't available via Trigger-API...
kind regards, Jens
Hello Jens,
Just another idea: what about calling the Integrity API directly from the trigger (not through the beans)?
Then, your result set is different and I hope then the field lenght will be returned.
Have you tried this?
Volker
Hi Volker,
never tried to call the API directly from within a trigger script, but if this works, it sounds like a good idea. Are there any specialties or obstacles regarding API-calls from trigger-scripts?
kind regards, Jens
Hallo Jens,
I am attaching herewith an API example. Hope this explains this "Trigger calls API" approach and helps.
Volker
Hi Volker,
thank you for the example script. I'll try to test how this could work in our environment and I'll give you an update afterwards...
kind regards, Jens