Hi,
I'm new to SAP HANA, and know I'm facing this problem:
I've been given an entity declared like this:
Entity translation {
key id: Integer64 not null;
en: String(5000);
fr: String(5000);
de: String(5000);
it: String(5000);
es: String(5000);
zh: String(5000);
ko: String(5000);
ru: String(5000);
jv: String(5000);
ar: String(5000);
pt: String(5000);
ja: String(5000);
};
So you get the id and depending on the language that is been used, you choose one column or other
For example: we are using the language "english" (en). So I've got a global variable: var lang = "en";
Is it possible to perform a select with XSDS like this, so I choose the column i want to display depending on the variable "lang"?
var XSDS = $.import("sap.hana.xs.libs.dbutils", "xsds");
var MyEntity = XSDS.$importEntity("package", "model.translation");
// retrieve entity instance
var query = MyEntity.$query().$where(MyEntity.id.$eq(1));
var results = query.$execute();
// process result
if (results.length > 0){
$.response.setBody(JSON.stringify(results[0].lang));
}
Of course this code is wrong, but is just so you canget the idea...
Thank you very much