RTC Forums
August 11, 2020, 08:41:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Field value required  (Read 564 times)
bebeantics
RTC License+
****
Posts: 27


« on: May 08, 2020, 11:46:07 AM »

Hello

A have a client/server application. Server runing as Windows Service, the client is an Android App.

On Server side i have a function, getAmef with this code:
procedure Tdmactivserver.getAmefExecute(Sender: TRtcConnection;
  Param: TRtcFunctionInfo; Result: TRtcValue);
var tip:integer;
qr:tfdquery;
rtcDS: TRtcDataSet;
begin
  logfile('Citire casefiscale', '!', '!');
  if Param.isNull['tip'] then
    raise Exception.Create('Parametru TIP lipseste!')
  else tip:=param.asInteger['tip'];

  case tip of
  1: logfile('Tip case: AMEF FISCALIZATE' , '!', '!');
  2: logfile('Tip case: AMEF NE-FISCALIZATE', '!', '!');
  else begin
          logfile('Tip case: '+tip.ToString, '!', '!');
          raise Exception.Create('Parametru TIP cu erroare!');
  end;
  end;

  try
    qr:=tfdquery.Create(self);
    qr.Connection:=db;
    try
      case tip of
      1: begin
           qr.SQL.Add('SELECT c.seria, cast(c.aviz as char(10)) aviz, c.dataachizitie, c.configuratia, c.fiscalizata, c.idclient, c.idpctl, c.NUI, c.datavanzare, c.achizitieproprieclient, cl.denumire utilizator, pl.adresa');
           qr.SQL.Add(', pl.localitatea, pl.judet, cl.tel1, cl.sms FROM casefiscale c');
           qr.SQL.Add('left join clienti cl on cl.id=c.idclient');
           qr.SQL.Add('left join punctedelucru pl on pl.id=c.idpctl');
           qr.SQL.Add('where c.fiscalizata=1 order by cl.denumire');
      end;
      2: begin
           qr.SQL.Add('SELECT c.seria, cast(c.aviz as char(10)) aviz, c.dataachizitie, c.configuratia, c.fiscalizata, c.idclient, c.idpctl, c.NUI, c.datavanzare, c.achizitieproprieclient, cl.denumire utilizator, pl.adresa');
           qr.SQL.Add(', pl.localitatea, pl.judet, cl.tel1, cl.sms FROM casefiscale c');
           qr.SQL.Add('left join clienti cl on cl.id=c.idclient');
           qr.SQL.Add('left join punctedelucru pl on pl.id=c.idpctl');
           qr.SQL.Add('where c.fiscalizata=1 order by cl.denumire');
      end;
      end;
      qr.Open();
      logfile('Inregistrari='+qr.RecordCount.ToString, '!', '!');
      rtcDS := TRtcDataSet.Create;
      try
          DelphiDataSetToRtc(qr, rtcDS);
          Result.asObject := rtcDS;
      except
      on E:EDatabaseError do begin
              logfile(e.Message, 'Exception', 'getAMEF.rtcDs');
              rtcDS.Free;
      end;
      end;
    except
      on E:EDatabaseError do begin
              logfile(e.Message, 'Exception', 'getAMEF.qr');
      end;
    end;
  finally
    qr.Close;
    qr.Free;
  end;

end;

On the client side, function request is:
procedure TfrmAmef.Button4Click(Sender: TObject);
var tip:integer;
begin
      if sw1.IsChecked then  tip:=2
      else tip:=1;

      //  amef
       log.d('Request Amef');
       log.d('Tip='+tip.ToString);

       //dm.RtcClientModule.CancelRequests;
        with dm.RtcClientModule do begin
          data.Clear;

          with data.NewFunction('getAmef') do begin
              param.asInteger['tip']:=tip;
          end;

          try
            call(dm.rtcResult1);
          except
            on e:exception do begin
                log.d(e.message);
            end;
          end;
        end;

end;

The result side is:
else
  if (Data.isType=rtc_Function) and (Data.asFunction.FunctionName='getAmef') then begin
      log.d('Rezultat la '+Data.asFunction.FunctionName);
      if Result.isType = rtc_Dataset then begin
        log.d('+');
        rtcMamef.Close;
        try
          rtcMamef.asDataSet := Result.asDataSet;
          Result.Extract;
          rtcMamef.Open;
          log.d('Recno='+rtcMamef.RecordCount.ToString);
        except
          on e:exception do
          log.D(e.Message);
        end;
      end
      else
  end

First problem is this, and i can't figure out how to solve it:
rtcMangDs is an rtcclientdatasource.

If I try to manage the fields (with the field manager), log.d displays the error message Field value required.
If I do not add any field in the field manager, I receive the correct answer and and everything works.

The second problem, o functions on server side,
if one field is index key, unique, unsigned, I have to do CAST on it to be able to work with that field in field manager.


How can I handle these problems, especially since the former holds me in down.
With thanks

Field value required.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1825


« Reply #1 on: May 08, 2020, 12:06:28 PM »

As much as I'd like to help you, please understand that you are trying to use a LEGACY unit (rtcDB.pas), which has been DISCONTINUED more than a year ago. If you want to continue using any components or units which have been moved to the "Legacy" folder in RTC SDK v9.50 (latest stable release), make sure you can maintain them on your own. We are no longer using nor maintaining any components or units from the LEGACY folder and can NOT provide any kind of support if you bump into any problems with them.

In short, if you find any "useful" components or units is in the "Legacy" folder of the latest RTC SDK release, feel free to use them, but please be aware that you will be USING THEM AT YOUR OWN RISK, WITHOUT ANY KIND OF SUPPORT FROM US.

Thank you for your understanding.

Best Regards,
Danijel Tkalcec
Logged
bebeantics
RTC License+
****
Posts: 27


« Reply #2 on: May 08, 2020, 12:39:32 PM »

Hi. What would be the closest methods usable to transcribe this function? There must be something.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1825


« Reply #3 on: May 08, 2020, 12:44:54 PM »

Search the Forum for old posts or check the FAQ and Quick Start sections if you can find anything useful, but ... as said ... I can NOT help you with your problem.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.025 seconds with 17 queries.