I would like to ask about Transient object.

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

I would like to ask about Transient object.

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:49 pm

by m&m >> Sat, 31 Jan 2004 19:59:35 GMT

Hi guys, I just start learning Jade . I got stuck when try to access Transient object. suppoase I create class named "tempValue"(public-real-transient) which has 2 attributes named "valX" and "valY" both are String.

begin
vars
crtempValue : tempValue;
create addJovcUser transient;
crtempValue .valX :="1";
crtempValue .valY :="5";
write ( crtempValue.valX & crtempValue.valY);
end;

I would like to how can I retrive the data stored in crtempValue.valX and crtempValue.valY ..

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: I would like to ask about Transient object.

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:49 pm

by dcooper@jade.co.nz >> Sun, 1 Feb 2004 20:53:29 GMT

The code as you've posted it won't compile. If you have your TempValue class (all classes in JADE start with a capital letter), your code needs to look something like:

vars
crtempValue : TempValue;begin

create crtempValue transient;
crtempValue.valX :="1";
crtempValue.valY :="5";
write crtempValue.valX & crtempValue.valY;
epilog
delete crtempValue;
end;

The epilog isn't strictly necessary (eg: you may want to assign crtempValue to a reference somewhere to use the object later), but in the example above you probably want to delete crtempValue once you've finished with it and epilogs are a good place to do stuff like that.

Dean.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 15 guests