cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

IM: how can i get the max. fieldsize (not the length of the value) in a trigger script?

JensN.
14-Alexandrite

IM: how can i get the max. fieldsize (not the length of the value) in a trigger script?

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

6 REPLIES 6

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

JensN.
14-Alexandrite
(To:VolkerEckardt)

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

JensN.
14-Alexandrite
(To:VolkerEckardt)

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

JensN.
14-Alexandrite
(To:VolkerEckardt)

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

Announcements


Top Tags