How to access different columns with the same name in COS?
I have this code:
SELECTid,room,client->name,functionary->nameFROM rooms ORDERBYidWhat i do to access the "client" name?
set rs = $SYSTEM.SQL.Execute("SELECT id,room,client->name,functionary->name FROM rooms ORDER BY id")
zw rs.%Get("name")
"return functionary name"Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.5 (Build 659U) Mon Mar 22 2021 07:03:57 EDT
Discussion (2)0
Comments
You can use 'client->name as clientname' and .%Get("clientname") or use .%GetData(columnnumber)
You can change your query, given alias to the columns:
SELECTid,room,client->nameas ClientName,functionary->nameas FunctionaryName FROM rooms ORDERBYidThen in COS you access the columns by name:
Write rs.%Get("ClientName")
Write rs.%Get("FunctionaryName")