I need assistance regarding scripting.
I have a named query which fetches records and I want that particular column to be stored in list.
What I have done was …
Not helping mate,
Instead of showing the data, it showing someothere inbuilt functions data
ds = system.db.runNamedQuery("Defects/Lookups/SelectHostandIP")
pds = system.dataset.toPyDataSet(ds)
LocalHostName = system.net.getHostName()
print("Printing Available HostName List")
for HostName in pds:
lists = HostName
I’m getting the result like this,
THE DESIRED output,
results = system.db.runNamedQuery(...)
colList = results.getColumnAsList(columnNumber)
FYI, you can always use something like the following to get a list of available methods/attributes on an object
for item in dir(results):
Can you show the actual script you’re running? When you post, use the
</> button to format it properly.
Please take a look at the post it self.
print makes a new line. Instead of printing inside the loop, add the value to a list that you initialize before the loop. Then print it after the loop ends.
You don’t need to convert to pyDataSet if you use
.getColumnAsList(columnNumber) directly on the named queries results
Now i learned How to use this