Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Issue with loading JSON into XSJS

$
0
0

I'm trying to load a JSON file into HANA (SAP HANA ONE, on AWS, SPS6), using the outbound XSJS functionality.

 

I'm following Thomas Jung's example where he demonstrated the Server Side Javascript Outbound Connectivity functionality (http://scn.sap.com/community/developer-center/hana/blog/2013/07/01/sap-hana-sps6--various-new-developer-features). I've omitted any url parameters and am trying to load a JSON file from a different webserver. The code so far is attached.

 

The contents of the JSON file:

[{"FN1":"20130806.csv"},

{"FN2":"20130807.csv"}]

 

I've been able to access the file and load the contents into variable 'body', with statement body = response.body.asString();

 

Displaying the results into the webbrowser works when using:

$.response.contentType = "text/plain";

$.response.setBody(body);

 

When I I've parsed the json using JSON.parse into a variable userDet, I can't 'extract' the values of the JSON;

e.g. $.response.setBody(userDet.FN1); delivers a '500 - INTERNAL SERVER ERROR'

 

Statement: $.response.setBody(userDet.length); delivers value 2 (which is correct). My hunch is that, just as in Jquery you can't just insert the values of an object to the screen (a DOM object), however in the example coding of PopUser.xsjs the values are written directly to a variable (e.g. pstmt.setString(1, userDet.ITAB.PERS_NO);)

 

Any ideas on how to extract the values from the array?


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>