Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Example dataset from php call
Mon, Apr 23 2018 4:09 PMPermanent Link

jdforce

Avatar

Hi, am new to EWB. For my customers with Linux server, we have php scripts that return a JSON dataset with a call like:

https://(mydomain)/list_invoices.php
The parameters send in POST are:  from=20180401,  to=20180423

These php scripts are called via AJAX from the client to fill dynamically the client content, and now am going to use EWB for creating the pages.

The php script return a formatted Json with the predefined database content.  In the example above these parameters are dates, of course but they can be anything. The php script processes and sends back the json page.
The returned json dataset contains date, invoice number, description and amount fields.

I need an EWB example for this type of connection. Already checked the included examples but only see configuration for the Elevate web server or local storage.
Thanks,

JD
Mon, Apr 23 2018 4:56 PMPermanent Link

Raul

Team Elevate Team Elevate

On 4/23/2018 4:09 PM, jdforce wrote:
> These php scripts are called via AJAX from the client to fill dynamically the client content, and now am going to use EWB for creating the pages.
>
> The php script return a formatted Json with the predefined database content.  In the example above these parameters are dates, of course but they can be anything. The php script processes and sends back the json page.
> The returned json dataset contains date, invoice number, description and amount fields.

Is you JSON in the EWB default dataset format ?

EWB reference is here :
https://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=JSON_Reference

If it's not then i would suggest to modify server side PHP to match EWB
request and response formats and you can simply use the built-in dataset
functionality "as is".

> I need an EWB example for this type of connection. Already checked the included examples but only see configuration for the Elevate web server or local storage.

In general you can use TServerRequest which is basic HTTP Request and
that allows you to populate URL with parameters.

However this simply provides your EWB app with the JSON and you'd still
need to process it yourself once you receive it.

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Executing_Request


PDF Client Example and Login Client Example show how to use TServerRequest

Raul
Mon, Apr 23 2018 5:17 PMPermanent Link

jdforce

Avatar

Hi Raul,

>Is you JSON in the EWB default dataset format ?

That is no problem, the php output can be easily formatted.

>However this simply provides your EWB app with the JSON and you'd still
>need to process it yourself once you receive it.

What I need to do is precisely to  make the app treat the JSON as a dataset that I can display on a grid, sort, Etc.. In this case, it will be read only,  of course.

Thanks for your help.

JD
Mon, Apr 23 2018 8:45 PMPermanent Link

Raul

Team Elevate Team Elevate

On 4/23/2018 5:17 PM, jdforce wrote:
>
> What I need to do is precisely to  make the app treat the JSON as a dataset that I can display on a grid, sort, Etc.. In this case, it will be read only,  of course.
>

There is actually an almost complete php implementation from Elevate
Software.  See binary NG :

https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_binaries&msg=45&page=1

It's not officially supported but might be a good way to quickly get
some of the json capability into your own PHP app

Raul
Sat, May 5 2018 1:13 AMPermanent Link

Pasquale

Web Pos srl

Example for connect form your php file (json result)

you just have to replace the names of the columns with those of your json



jdforce wrote:

Hi Raul,

>Is you JSON in the EWB default dataset format ?

That is no problem, the php output can be easily formatted.

>However this simply provides your EWB app with the JSON and you'd still
>need to process it yourself once you receive it.

What I need to do is precisely to  make the app treat the JSON as a dataset that I can display on a grid, sort, Etc.. In this case, it will be read only,  of course.

Thanks for your help.

JD



Attachments: pphpform.zip
Image