Toad World® Forums

Import old Script in New Toad

Hello everyone,

I just bought the new version of Toad Modeller coming from version 2.25

The import went well, but I have a problem with a script that I had done in the old version.

I changed the generation of TriggerSequence going to create just before the corresponding sequence.

How can I redo the same change in the new Toad?

I attach a screenshot and scripts

Thanks

jsScriptToad2.25 (2.89 KB)

Hi,

do you want to have the trigger before or after the sequence then? In the code you sent it’s after the sequence and asking to have it before. Just confirm either of the two, please.

Thanks,
Lukas

Hi,

Thank you for answer.

In my code i have inserted this code before the trigger.

TrigName = ‘T_’+Name_replace_dot;
if ( TrigName.length > 30 )
TrigName = TrigName.substring(0,25) + Attribute.Id.toString();
TrigName_u = ‘U_’+Name_replace_dot;
if ( TrigName_u.length > 30 )
TrigName_u = TrigName_u.substring(0,24) + ‘_’ + Attribute.Id.toString();
// Create Sequences
TextStream.Writeln( ’ ’ );
TextStream.Writeln( ‘/* Sequence for table ‘+Entity.TableName+’ linked to attribute ‘+Attribute.ColName+’ */’ );
TextStream.Writeln( ‘CREATE SEQUENCE "’+Name+’" ');
TextStream.Writeln( ‘INCREMENT BY 1 START WITH 1 MAXVALUE ‘+maxSeq+’ MINVALUE 1 CYCLE NOCACHE ORDER’);
TextStream.Writeln( term );

Hi,

we got it. In fact, now you don’t need to re-do anything. You just have to create a sequence and use it with the given attribute in TDM (combobox User Sequence (trigger)).
Note: In Attribute Properties, there is a button “…” next to the combobox Used Sequence (trigger) (see the screnshot). It opens dialog Sequences with a list of all sequences, you can also add a new one.
If you want to create a sequence with different default values, first you have to have Expert Mode enabled in Settings | Options | General check Expert Mode.
Then go the the dialog Sequence, open any existing sequence and right-click anywhere and select Default Values for Class. There you can change default values.

IHTH

Cheers,
Lukas