RE: SDL-News: Using the content of a string as a literal


Subject: RE: SDL-News: Using the content of a string as a literal
From: Anthony Weber (weberaa#stedeksoftware.com)
Date: Thu Aug 14 2003 - 04:33:37 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From "Anthony Weber" <weberaa#stedeksoftware.com> to sdlnews -----

Marga,

It's possible to key using a charstring as a literal. If you set up an
array with a Charstring as its index and another Charstring as its element
type, use the synonym values as indices, assigning the elements the values
of the synonyms, themselves...

For example, the following are the indices:

synonym fieldOne Charstring = 'fieldOne';
synonym fieldTwo Charstring = 'fieldTwo';
synonym fieldThree Charstring = 'fieldThree';

NEWTYPE CharstringArray
    ARRAY (Charstring, Charstring)
ENDNEWTYPE;

Next, the elements of the array need to be initialized:

DCL A CharstringArray;

A(fieldOne) := 'XYZ',
A(fieldTwo) := 'ZAB',
A(fieldThree) := 'ABC'

Now, as you can see, each literal is actually an index into each element of
the array.

Hope this helps.

Tony Weber
STEDEK Software
weberaa#stedeksoftware.com

-----Original Message-----
From: owner-sdlnews#sdl-forum.org [mailto:owner-sdlnews#sdl-forum.org] On
Behalf Of Margarita de Cabo Pérez
Sent: Wednesday, August 13, 2003 5:28 PM
To: sdlnews#sdl-forum.org
Subject: SDL-news: Using the content of a string as a literal

Become an SDL Forum Society member
<http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From =?ISO-8859-1?Q?Margarita_de_Cabo_P=E9rez?=
<marcab#yllera.tel.uva.es> to sdlnews -----

Hi,

I want to use the content of a charstring as a literal, I mean, I have a
charstring containing the name of a literal, and I want the value of that
literal. I am trying to do the following:

dcl cadena charstring:="fieldOne";
synonym fieldOne charstring:="XYZ";

I need to obtain "XYZ" using variable cadena.

 Can anybody help?

Marga
--End text from =?ISO-8859-1?Q?Margarita_de_Cabo_P=E9rez?=
<marcab#yllera.tel.uva.es> to sdlnews ---
For extra SDL Forum Society benefits join at
<http://www.sdl-forum.org/Society/members.htm>
or (iff this does not answer your question) email:
owner-sdlnews#sdl-forum.org

--End text from "Anthony Weber" <weberaa#stedeksoftware.com> to sdlnews ---
For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT