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)  //

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

ie $ 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.

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


Sorted. Thanks.


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


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


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()

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 ?

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.