I am new to Azure App Service.
I\'ve created a view in Azure database to get data across several tables. Now I want to use the data from this view in my Cordova App
Had a similar issue but fixed it now, am using a .Net backend thou. 1. Log into azure portal and select the database you want to create the view in Then select the query Editor in the left pane. 2. Use the sql to create the query. 3.Create a table in the asp.net backend that matches your fields in your view. 4.Go to your asp.net backend and create a custom Api and write the following codes:
public class HelloCustomController : ApiController
{
MobileServiceContext context;
public HelloCustomController()
{
context = new MobileServiceContext();
}
[HttpGet]
public async Task> Get()
{
try
{
var users = context.Database.SqlQuery("Select * from
dbo.vwUser);
return await users.ToListAsync();
}
catch(Exception ex)
{
return new List()
{
new vwUser
{
UserName=ex.Message
}
};
}
}
4.You edit my codes to select from your view. 5. Create a similar class in your mobile app that matches what u created in your backend. 5. You can then access your view by calling it in your mobile app with the following codes:
var users= await client.InvokeApiAsync("HelloCustom",HttpMethod.Get,null);
Thanks Guys. This is my fisrt answer to this beautiful community that carried me from day 1 of programming till now that am a bit conversant.