I am using system.db.runPrepQuery for a Select statement, but when there is not any information I need to return a 0. If i was doing this in a SQL Query I would use Select coalesce( Select * From Here Where a=b),0). The issue is when I am trying to do this same function in the scripting function of a button with runPrepQuery. Any help with the scripting would be greatly appreciated.
you can check the length of a dataset in scripting using a runPrepQuery
a = 'b'
myDS = system.db.runPrepQuery("SELECT ID, EDate, ETitle, EText FROM ETable WHERE(ETitle = ?)", [a],'DataSourceName')
print len(myDS)
If len(myDS)>0:
DoSomething
else:
DoSomethingElse
1 Like
Thanks for the help. Did not think about length to check against. Worked great.