ORDA generic programming


May be a silly question. My knowledge of ORDA is limited.

How can you make a query in ORDA where you do not know the table,
but have a pointer to the table.


ds.(tablepointer->).query(“xSeqnr = :1”;“0000010023467”)

I know the fieldname, but the table can be any.

Best Regards


I think with the pointer on the table, you can get the table name (with the Table name command).

Then you can do: ds[tableName].query() with tableName being a String.

Hi Magnus,

I would prefer to get the table name of the pointer and use it

$tableName:= table name(tablePointer)
$coll:=ds[tableName].query(“xSeqnr = :1”;“0000010023467”)

something like that (not tested) and written on the fly :wink:


Dear Marie-Sophie and Patrick,

Thanks, that will probably do the trick.
I tried myself to do it similar, but did not know
the bracket [] syntax. All examples go for ds.tablename.function
or dataclass.function.

Best Regards


I am trying to do similar but getting an error where the table name includes 2 underscores
so joom_modules is ok but joom_modules_menu gives an error
Trying to update the table with a collection built from mysql.
Can I use 2 underscores in table name ?

		New object($updated)
		$tablename_t:=Replace string($asMySQLTables{$i};$TablePrefix_t;"joom_")

Ignore. I keep forgetting with ORDA you have to restart when renaming tables and relatons.

Anybody must take care to never named a table with any kind of reserved word.
Just for example here some ds.func()
but there are more kinds of reserved words.

Just for one example, do not name your table “getInfo”,
this name is not a sql-reserved-word but it is a reserved word in 4D.
No warning appears when you create thuch ORDA incompatible table-names
but when later execute in ORDA than you got a runtime-error.

I wish we didn’t have to restart. Super inconvenient in client/server in interpreted.

Sannyasin Siddhanathaswami

Beginning with v18 R3 the restart isn’t necessary anymore.
See here Orda and Objects in a real world

1 Like

I am writing my ORDA calls allways as following:

$EntitySel:=ds[Table name(->[Adressen])].query(Field name(->[Adressen]Name)+"=:1";$FindName)

If later a table or field is renamed, the pointer to the table/field is allways actually.