Sebastien
Take a look at http://gradvs1.mgateway.com/download/extreme1.pdf
It may help you understand globals, particularly if your previous
experience is oriented towards relational models
Rob
On Wed, 03 Oct 2007 04:47:24 -0700, Sébastien de Mapias
<sglrigaud@[EMAIL PROTECTED]
> wrote:
>OK thanks a lot John.
>
>Do you mean that creating indices like you put it (with an 'X' suffix
>at the end of your globals names) is a convention when using M[umps] ?
>
>To make sure I understood the syntax and how it works (because I'm
>*very* new to M language) when you have a global 'Stuff' containing
>zillions of records like:
>~ set ^Stuff(1) = "ABC`12380`xyz"
>~ set ^Stuff(2) = "DEF`98787`ghf"
>
>in order to index Stuff data other than the numeric subscript used
>above you have to do the following ?:
>~ i := how many records Stuff contains
>~ for x := 1 up to i loop
>~ field2_value := get 2nd value in array of ^Stuff(x)
>~ ^StuffX(field2_value) := x
>~ /* or if several times the same value possible:
>~ ^Stuff(field2_value,x) := null */
>~ end loop
>
>Is this *really* the way to go ? Is this how it works with M[umps] ??
>
>Thanks !
>Regards,
>Sébastien
>
>
>On 3 okt, 10:12, John Murray <jo...@[EMAIL PROTECTED]
> wrote:
>> Index example:
>>
>> Construct and maintain ^StuffX(piece2)=i (if there can only be a
maximum
>> of one record with a given piece-2 value), or ^StuffX(piece2,i)="" (if
>> there can be multiple records with a given piece-2 value).
>>
>> Then (first case):
>>
>> set i=$get(^StuffX(12380))
>> if i'="" do ProcessStuff
>>
>> Or (second case):
>>
>> set i=""
>> for set i=$order(^StuffX(12380,i)) quit:i="" do
>> ProcessStuff(i) quit
>>
---
Rob Tweed
Company: M/Gateway Developments Ltd
Registered in England: No 3220901
Registered Office: 58 Francis Road,Ashford, Kent TN23 7UR
Web-site: http://www.mgateway.com
Out of the Slipstream: Come to the conference!
http://www.outoftheslipstream.com


|