Dynamic Drop down list based on import from Zoho Reports

Dynamic Drop down list based on import from Zoho Reports

Hi all,

Any help would be appreciated!

I have this app connected to my database in Zoho Reports. I want to create a dynamic drop down list in my stateless form which fetches all the value from one column in a Zoho Reports table. 

I found the 5 years old post with similar topic.
https://help.zoho.com/portal/en/community/topic/desparate-help-please-reporter-and-creator 

I tried to use Zoho Reports Export API with the following codes
  1. ticketDetails = getUrl(("https://accounts.zoho.com/login?servicename=ZohoReports&FROM_AGENT=true&LOGIN_ID=<email>&PASSWORD=<password>"));
  2. ticket = ticketDetails.toString().subString((ticketDetails.indexOf("TICKET=")  +  7),(ticketDetails.indexOf("RESULT")  -  1));
  3. query = "SELECT \"col name\" FROM \"table name\""; 
  4. url = (("https://reportsapi.zoho.com/api/<email>/<DB>/<table name>?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&ZOHO_API_KEY=<AUTHENKEY>&ticket=" + ticket) + "&ZOHO_API_VERSION=1.0&ZOHO_SQLQUERY=") + query;
  5. response = getUrl(url);
  6. result = response.executeXPath("/root/response/result/rows/text()");
  7. clear Table_NAME;
  8. Table_NAME:ui.add(result.toList("-|-"));

But I keep getting errors:
Error details:
Error in executing On Add - On Load script.
Error.
Error in executing Set Variable task. Unable to update template variable result.
Error evaluating STRING expression :
Invalid XML/JSON format.

Please let me know if there is any solution to this. 

Thanks in advance!