Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 14 of 14 total
Thread Datasetmodule example
Wed, Mar 23 2016 6:24 PMPermanent Link

KimHJ

Comca Systems, Inc

Tim,

I was able to run the Demo in Delphi by "Run as Administrator" and run the datasetmodule .

Kim
Mon, Mar 28 2016 1:23 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< I did that but I get an error " The requested operation requires elevation." I gave my self Full Control to the whole hard drive I moved the project to the User folder and I still get it. I'm using Windows 10 and Delphi XE6. >>

Are you trying to run the datasetmodule project from the \Program Files location ? If so, then *that* is your problem.  You need to run the datasetmodule from the:

\My Documents\Elevate Web Builder 2\Projects\datasetmodule

directory.  This is where EWB 2 puts the example projects when you install them using the IDE:

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Example_Applications

<< let me know if this is correct or if I'm missing something. >>

You only need the HandleRequest call and that's it.  The HandleRequest method handles the cache-control headers and everything, including sending the JSON response.

If you want *other* requests in addition to standard dataset requests using the EWB API, then use a different module project or put the interrogation of the incoming requests *before* the HandleRequest call.  In other words, do something like this:

var
  TempHandled: Boolean;
begin
  TempHandled:=False;
  if AuthenticateUser(Request) then
       begin
       case Request.RequestMethod of rmGet:
          begin
          if AnsiSameText(Request.RequestParams.Values['customer'],'paramvalue') then
             begin
             TempParam := FindCustomer(Request.RequestParams.Values['customer'],'paramvalue');
             Request.ResponseHeaders.Add('Cache-Control: no-cache');
             Request.SendContent(TempParam,HTTP_OK,'1');
             TempHandled:=True;
             end
          else  if AnsiSameText(Request.RequestParams.Values['pickup'],'paramvalue') then
             begin

             TempHandled:=True;
             end;
          end;
       end;
   if (not TempHandled) then
      DatabaseAdapter.HandleRequest(Request,'customdatasets');
end;

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Mar 29 2016 7:50 PMPermanent Link

KimHJ

Comca Systems, Inc

Tim,

<<You only need the HandleRequest call and that's it.  The HandleRequest method handles the cache-control headers and everything, including sending the JSON response.

If you want *other* requests in addition to standard dataset requests using the EWB API, then use a different module project or put the interrogation of the incoming requests *before* the HandleRequest call.  In other words, do something like this:

var
  TempHandled: Boolean;
begin
  TempHandled:=False;
  if AuthenticateUser(Request) then
       begin
       case Request.RequestMethod of rmGet:
          begin
          if AnsiSameText(Request.RequestParams.Values['customer'],'paramvalue') then
             begin
             TempParam := FindCustomer(Request.RequestParams.Values['customer'],'paramvalue');
             Request.ResponseHeaders.Add('Cache-Control: no-cache');
             Request.SendContent(TempParam,HTTP_OK,'1');
             TempHandled:=True;
             end
          else  if AnsiSameText(Request.RequestParams.Values['pickup'],'paramvalue') then
             begin

             TempHandled:=True;
             end;
          end;
       end;
   if (not TempHandled) then
      DatabaseAdapter.HandleRequest(Request,'customdatasets');
end;>>

Thanks Tim this get me started. My if is incorrect because I want to see if the parameter name is equal to 'customer' not the value. I tried the different methods of Request but I have not been able to find it.

Kim
Thu, Mar 31 2016 2:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< Thanks Tim this get me started. My if is incorrect because I want to see if the parameter name is equal to 'customer' not the value. I tried the different methods of Request but I have not been able to find it. >>

Use this:

if Request.RequestParams.IndexOfName('customer') <> -1 then
// Parameter was found

Tim Young
Elevate Software
www.elevatesoft.com
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image