on 05-22-2014 5:35 PM
Hi HANA Experts,
I was trying to build a application where:
1) Users will enter a state
2) And application will return the list of customer in that state
I created a UI5 Application project in HANA Studio. Got the "index.html", the view and it's associated controller files. I then tried to call the data-base using the xsjs calls inside the controller. Like $.db.getConnection() etc. The file got activated. However, it started giving errors when I tried to run from the browser. And I saw that system is unable to find ANY OF THE "$" FUNCTIONS OF XSJS. I saw that the XSJS library files are missing from the Project. So I manually added it to the UI5 application Project. But the error existed.
My question is:
1) How to call "$.db.getConnection()" and other "$" functions from the UI5 application projects?
2) What's the technical difference between "XSJS" proejct and "UI5 Application" project?
3) When to use each of these Project types?
4) I now went ahead and created a "XSJS" project in HANA studio. The "$.db" functions started working. However the UI5 application libraries went missing. Does this mean UI5 is not compatible with "XSJS" services
5) If you can share me a sample code of using UI5 and XSJS, would be a good help
Your answers will be very much appretiated.
Regards,
Kowshik
You misunderstand what is executing where. The .js files of the UI5 application are sent to the client side web browser and execute there. Therefore they can't possibly execute the xsjs apis. These only execute within the XSEngine within HANA on the server side. You write your server side code in XSJS files and these create REST services. You call these services from the client side within UI5 using jquery.ajax or the UI5 model object.
I would suggest that you install and study the example applications from the SHINE content:
http://help.sap.com/hana/SAP_HANA_Interactive_Education_SHINE_en.pdf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gentleman,
So if I am building a Java based application on HANA...are you recommending to build 2 projects....One being a XSJS Project having all the XSJS services....and the other having all the UI based views and controllers.....
Ideally, I would like to have only 1 Project. Which should have both the XSJS services and the front-end SAP UI based HTML pages.
I could see that it can be done in 1 single project:
I copied this and it's running fine on the HANA cloud trial instance.
Please share me your suggestions / recommendations and the best practice.
Regards,
Kowshik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
while creating UI5 codes, it uses pure javascript coding. XSJS and Javascript are different. You can not write database connectivity and such server logic in UI5 project.
You create one xsodata/xsjs corresponding to your business logic and consume the same from your UI via OData model or ajax call.
Sreehari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.