Open success4shambhunath opened 6 years ago
I'm sorry - what is your question? I don't understand.
Actually, columnMetadata.name and columnMetadata.label both are returning the same values but name suppose to return e.g MATNR and label should return "Material Number".
Hope, you can understand.
Thanks,
Shambhu Nath
I see what you mean. The way it works is that you can pass label info in the header query parameter. See parseHeader in the querybuilder.xsjslib.
The header parameter is parsed as JSON, and can be an array of strings, or an array of object literals. If an array of strings, then these strings will be used as aliases for the SQL columns. If an array of objects,then the label propery of each object is used as label.
What it does not currently do is grab label metadata from the database. You'll have to push it from the client side.
It would be cool to have an automatic label defaults in case the caller does not provide them. I will happily accept a pull request for that.
Thanks Roland, I'm getting label from the client side as you suggested, I wanted to get confirmation from you, it is correct approach to get label from client, since metadata is not pulling label. It would be great if metadata grab label in future, So we can avoid additional logic to pull from the client.
@shambhuhyd I'm willing to look into the feature but it would help if you could tell me the expected behavior in the cases you're interested in. If you could do the research and tell me where to fetch the labels from in the SAP HANA data dictionary, that would be really cool.
Thanks in advance, Roland,
Hi Roland, I have written table function to fetch labels, in the table function I'm using CONTENT_TEXT_HISTORY and ACTIVE_OBJECT_TEXT_CONTENT tables from the _SYS_REPO schema in that passing PACKAGE_ID & OBJECT_NAME as parameter. The CONTENT_TEXT_HISTORY table maintained labels changes history so we have to filter out maximum version to get latest labels, if objects does not have history then you would not get labels in CONTENT_TEXT_HISTORY, this kind of scenario you can get quality & production system, Then in case we have to use table ACTIVE_OBJECT_TEXT_CONTENT to get the labels, I used this approach, I have tested and seems working fine.
HeaderLabel.txt Tablefunction format is not allow to attached hence attached in txt format.
Thanks, Shambhu Nath
Hi @shambhuhyd , thanks man! This looks really promising, it's a nice step towards a solution. I think that for ODXL it would be best to wrap it inside a xsjs script - a table function will need authorization and I'd like to avoid that as it will make it more difficult to use ODXL.
What are your thoughts concerning how to control the label generation? What it he caller wants to specify some labels themselves, but have others be automatically supplied? I mean, how do you think the interface should look?
Hi Roland, Table function you can use in calculation view, So It will behave as scripted calculation views meaning no additional security required. We can pass select query fields in labels model to get respective labels but if caller want to labels then you can request them input from UI interface, You can collect it as array and merge in body. However, custom labels depend on business requirements so I can't say about the interface.
Table function you can use in calculation view, So It will behave as scripted calculation views meaning no additional security required.
I know you can use it in calculation views, my concern is they need authorization to install the table function.
We can pass select query fields in labels model to get respective labels but if caller want to labels then you can request them input from UI interface, You can collect it as array and merge in body.
I know this is what we can do, my question is more: how does the caller command what they want? How can odxl notice what the user wants to happen for each field? For the ones they provide a value for, it is easy - they'll want the specified label. But it is not self-evident that they'll want to generated label for the ones they do not specify anything for. It seems intuitive that if the user does not specify anything in particular, nothing in particular should happen, i.e. the label will be equal to the field name.
Makes sense?
In getColumnMetadata function, I'm getting same value: columnMetadata = columnsMetadata[i]; columnName = columnMetadata.name; columnLabel = columnMetadata.label; body += columnName + "\t";