Assign a var where name of var is in a local

Bit of brain fade going on. I am importing data from mysql and I am experimenting with ORDA. Therefore in the object I have the name of the Mysql fields and in 4D I have matching var’s

            For each ($element;$fieldgroup)  //
                   
                    $titlevar:=$element.name
                    $titlevar:=$title+"_t"

So for example the mysql field in the element is called exercise

ie $element.name= exercise so $titlevar := "exercise_t " this is the name of my 4d var.

Therefore from the object how do I assign a value to the variable exercise_t ?
the var is not used in a form.
Hope that makes sense.
Thanks
Paul.

You’ll need to use Get pointer($titlevar)

HTH

Sorted. Thanks.

Paul-

Your code references $title and $titlevar — where is $title assigned?

Mike

Mike,
The code fragment was incomplete. As Keith mentioned i need to use Get Pointer. I was looking at the ORDA documentation hence the confusion.
Paul

Hi,

You can also use an object as an HashMap (a key / value system) and do something like:

$myObj:= new object()
$myObj["exercise_t "]:=“value of my variable”

Would it suit ?

Thanks for reply,

I tried this and it looks promising

$fieldtext:=$element.FieldToText.query(“item_id = :1”;[Items]MySQLItemID)

				If ($fieldtext.length#0)
					$myObj:=New object()
					$name:=Lowercase($element.name+"_t")
					
					$myObj[$name]:=$fieldtext[0].value

Where $name is name of the mysql field this gives you an object with property and value as you say

{exercise_t:Yes we do }

So from the object how do I assign the process var exercise_t:=“Yes we do” ie the property name is the name of the var ?
Paul

If you have a defined variable "exercise_t "you can do

Get pointer ("exercise_t")->:=value

I have it working with get pointer. Confusion was trying to use an object.