Hello.
I’d like to know if is there a way to change the Return Format of a Named Query called via a Gateway script, similarly to what is possible to achieve by using a Query Binding as shown in the attached image.
It doesn’t look possible from what I can read from the official doc, but let me know if I’m missing out something.
I’m having issues uploading the image: here an external link.
I would like to receive the dataset in JSON format as in the attached image, without converting it using a script. Unfortunately I must use a legacy function which takes as an input a dictionary and I don’t have time to refactor it to accept a dataset or a pydataset.
Hello, thanks for your message.
It doesn’t look like I’m obtaining a JSON looking like the one I’m obtaining through Return Format.
It simply return the whole dataset structure as a JSON.
def datasetToDictArry(value):
pyDictArry = []
for row in range(value.getRowCount()):
pyDictRow = {}
for col in value.getColumnNames():
pyDictRow[col] = value.getValueAt(row, col)
pyDictArry.append(pyDictRow)
return pyDictArry
ds=aDataset
datasetToDictArry(ds)
you can put this in a project script so you can use it everywhere you want