If you don't have strong background in JavaScript, the easiest way would be to define a REST service, get all the data and display only the columns that you need. This can be done in under 10 minutes usually...
If you don't have strong background in JavaScript, the easiest way would be to define a REST service, get all the data and display only the columns that you need. This can be done in under 10 minutes usually...
I am taking a closer look at the JSON.stringify data that I now have. I have noticed that the order in which it is outputted is NOT according to the order of the columns in the database, but alphabetically. Why? Is there a way to output the JSON data so that it follows the order of the database columns?
Ok, I set up a REST service. Named it "REST Request". It is a GET and it works ... I tested it. Problem is that in the Response tab, I only listed the four items I wanted to pull down, but in the test output it still pulled down all of the columns for each row. What do I have to do to have it only show what I list under the Reponse tab?
And how do I make it so it doesn't output the columns alphabetically?!
When you test it will show the entire JSON response. If you defined only specific columns in the response, then only those will be available when you do mapping.
The objects should be in the same order as they are created in the database. Check the database docs, you can sort the result.
But I don't want to do mapping. I am taking the entire JSON response and packing it into one variable (that I am then sending out by email).
I know I can sort the result of the entries (rows) but I don't see a way to sort the column headers (or leave them in their default order, as arranged in the database). If you have a reference in the documentation that shows how to sort the column headers let me know, but even doing the simple test run for the REST Service they come out alphabetically.
Can you post a screen shot of how your database columns look, how the data looks and what order you need?
Do you refer to the fields (columns) in the return JSON object?
I am not sure what you mean. The return JSON object contains the database output that I have selected for using a where statement. I am getting it by
code
var response = JSON.stringify(data);
localStorage.setItem("json_response", response);
/code
Let me know if this is not what you meant.