[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

RE: 1886.1 Is ther a way to create an own global variable in Axapta.

Evelio

2/22/2006 6:06:00 PM

Zoechi,

You can use the Array class for that, for ex:

Array arrayOf = new Array(Types::Class);
;
arrayOf.value(1, yourObjectRefference1);
arrayOf.value(2, yourObjectRefference2);
....

You can do the same with lists of classes.

"zoechi" wrote:

> I would like to store an object reference to keep the object in Memory to access it from anywhere in Axapta.
>
> I thought that I read about this somtimes. But can't find it anymore.
>
> Günter Zöchbauer, Infox IT-Consult
>
> technet.navision.com Posting date: Wednesday, July 25, 2001
>
> technet.navision.com Posting path: Navision Axapta/Technology (Ax)/MorphX
1 Answer

David Pokluda

2/23/2006 4:29:00 PM

0

I would suggest to store the object in a global cache. I usually create a helper class with the following static methods:

public static boolean saveToCache(str _owner, anytype _object)
{
if (infolog.globalCache().isSet(_owner, null))
infolog.globalCache().remove(_owner, null);

return infolog.globalCache().set(_owner, null, _object);
}

public static anytype getFromCache(str _owner)
{
return infolog.globalCache().get(_owner, null, null);
}

public static void removeFromCache(str _owner)
{
if (infolog.globalCache().isSet(_owner, null))
infolog.globalCache().remove(_owner, null);
}

Hope it helps.

Regards,
David.

"Evelio" <evelio.larosa@scansourcela.com> wrote in message news:05B0CDA8-29F3-4CFC-BF63-0FFFBAC205A2@microsoft.com...
> Zoechi,
>
> You can use the Array class for that, for ex:
>
> Array arrayOf = new Array(Types::Class);
> ;
> arrayOf.value(1, yourObjectRefference1);
> arrayOf.value(2, yourObjectRefference2);
> ....
>
> You can do the same with lists of classes.
>
> "zoechi" wrote:
>
>> I would like to store an object reference to keep the object in Memory to access it from anywhere in Axapta.
>>
>> I thought that I read about this somtimes. But can't find it anymore.
>>
>> Günter Zöchbauer, Infox IT-Consult
>>
>> technet.navision.com Posting date: Wednesday, July 25, 2001
>>
>> technet.navision.com Posting path: Navision Axapta/Technology (Ax)/MorphX