Toad World® Forums

Calculated entity properties - how to find out a name of the current entit?


#1

Hello,

is it possible to create a new visible read-only calculated property of entity that will return at each entity e.g. a name of the corresponding archive table

  • e.g. “ARC_”+%TableName% ?

Can I find out in the called method what is the current entity?
It seems that the methods usable for “Get Script Method” are without any parameters.

Thanks.

Regards,

Lada


#2

Hello Lada,

Yes, it is possible.

  1. Create a new property in class where you like to have it and edit it.
  2. On the General tab, fill out a name and select the Read-only checkbox.
  3. Click the button next to the Get Script Method box. - (The names of a script and a method where the method will be implemented will be filled out.)
  4. Click Edit Script below. The following message might occur: Script xxx has not been found. Do you want to create a new script in…? - Click OK.
  5. Finally, add the script body that might look like this (example):

function GetMyCalculatedProperty()
{
return (‘Prefix’+Instance.Name);
};

See the “Instance” keyword in the code - it represents the object for which the method is called. It can be entity, attribute etc. - according to the class where it is defined.

Regards,

Vladka + Daril