Jump to content

pro_imaj

uniGUI Subscriber
  • Posts

    929
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by pro_imaj

  1. 1 hour ago, irigsoft said:

    Maybe You have problem with TNetEncoding.Base64.Encode and decoding , i am not sure.

    Can you try send request from RESTDebugger to Exe compiled by me.

    and see in Right memo, what result will show.

    Send request by this way direct in Browser: http://yourserver:port/JSON=EncodedBase64 (JSONdata).

    all must be in URL.

    Try to encode data with this: https://www.base64encode.org/

     

    I think you are using an old unigui version, so I cannot view it with your exe.

    I don't want to write a URL this is a solution that won't be right for the other party


    RestFull logic is fixed all over the world.

    image.png.b8a9e1c8759a8b0e100334190f420b9b.png

  2. On 3/4/2023 at 2:50 PM, irigsoft said:

    Hello, I use some kind of REST server.

    here is how to send data from Client: 

    http://YOURSERVER:PORT/JSON='  +  EncodeBase64 ('ALL_JSONDATA_LIKE_STRING');

     

    here is how to read data REST server :

    procedure TUniServerModule.UniGUIServerModuleHTTPCommand(
      ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
      var Handled: Boolean);
    begin

    //Check if is JSON
    if (POS ('/JSON',ARequestInfo.URI) > 0)
    then begin      
          AResponseInfo.ResponseNo := 200;
          AResponseInfo.ContentEncoding := '1251';

          ARequestInfo.Document := mmReadDocument (1,Copy (ARequestInfo.Document,Length ('/JSON=')+1,Length (ARequestInfo.Document))); //// DO YOUR REST STUFF
          AResponseInfo.ContentText := ARequestInfo.Document;
          AResponseInfo.WriteContent;
          Handled := True;
          AResponseInfo.CloseSession;
    end;
    end;

     

    How to process readded data REST server:

    unit MainModule;

    function mmReadDocument (iType: Integer; sDocument: String): String;

    var

    sDataList : TStringLIst;

    begin

    TRY

    sDataList := TStringLIst.Create;

    sDataList.DelimitedText := DecodeBase64 (sDocument);

    FINALLY

    sDataList.Clear;

    sDataList.Free;

    END;

    end;

     

     

     

    Hello,

    Thank you for the answer.

    I implemented your answer, but rest debugger does not return the correct result. I added the code you wrote into a small project, you can find the example in the attachment.

    While sending the data, I want to send it as below with rest debugger.

    URL http://localhost:8077/JSON

    Conten Type : { "Username": "test01", "Password": "test01"}

    image.png

    Rest_Full.zip

  3. 11 hours ago, andyhill said:

    This is how I return a PDF document

            AResponseInfo.ContentType:= 'application/pdf';
            AResponseInfo.ContentStream:= TFileStream.Create(FullyQualifiedPDF, fmOpenRead or fmShareCompat);
            AResponseInfo.ContentLength:= AResponseInfo.ContentStream.Size;
            AResponseInfo.WriteHeader;
            AResponseInfo.WriteContent;
            AResponseInfo.ContentStream.Free;
            AResponseInfo.ContentStream:= nil;
            AResponseInfo.ResponseNo:= 200;
            AResponseInfo.CloseConnection:= True;
            AResponseInfo.CloseSession;
            Handled:= True;

     

    I can do this myself. What I can't do is read the incoming JSON value. I can't see the incoming Json value.

  4. 16 minutes ago, pro_imaj said:

    Hi,

    Can I use it as Unigui Rest Full.

    So like this;
    I will send the following 1.json format as Post method to http://localhost:8077/user link.

    2. I will send it as a response in json format, can this be done?

    1. Json
    {
       "username": "a",
       "Password": "123"
    }

    2.Json
    {
       "Name": "bbbb",
       "Mission": "pppppp"
    }


    *I tried to do a lot of reasoning and examples but as a general problem. When I type http://localhost:8077/user I see the following error on the screen.

    Invalid session or session Timeout. (Invalid URI: /user )

    Is there a solution
    Thanks

    I have prevented the error from occurring as follows, but I cannot see the JSON value sent with CustomBody in ARequestInfo. How can I get the incoming CustomBody value.

     

    procedure TUniServerModule.UniGUIServerModuleHTTPCommand(
      ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
      var Handled: Boolean);
    begin
      if ARequestInfo.URI = '/user' then
      begin
    
        AResponseInfo.ContentText :=
          '{"Name": "bbbb","Mission": "pppppp" }'  ;
        AResponseInfo.ResponseNo := 200;
        AResponseInfo.WriteContent;
        Handled := True;
    
      end;
    
    
    end;

     

  5. Hi,

    Can I use it as Unigui Rest Full.

    So like this;
    I will send the following 1.json format as Post method to http://localhost:8077/user link.

    2. I will send it as a response in json format, can this be done?

    1. Json
    {
       "username": "a",
       "Password": "123"
    }

    2.Json
    {
       "Name": "bbbb",
       "Mission": "pppppp"
    }


    *I tried to do a lot of reasoning and examples but as a general problem. When I type http://localhost:8077/user I see the following error on the screen.

    Invalid session or session Timeout. (Invalid URI: /user )

    Is there a solution
    Thanks

  6. On 2/5/2023 at 12:46 AM, pro_imaj said:

    Hi @Marlon Nardi

    Attached is your Kendo example, when you compile please open the pie chart because there is a problem there.

    I want to show the "Isler" field and "Amount" field information when the mouse is hovered over the chart in the pie chart.The data structure is as follows.

       with ClientDataSet1 do begin
         CreateDataSet;
         // Works, Quantity
         AppendRecord(['a ISI',1 ]);
         AppendRecord(['b ISI',3 ]);
         AppendRecord(['c ISI',5 ]);
         AppendRecord(['d ISI',7 ]);
         AppendRecord(['e ISI',9 ]);
    
       end;

    For example, I want to see the following result when Pie is hovered over the chart with the mouse. "a HEAT :1 "

    It should be with the code below, but "{0} field returns "Amount" information, while {1} field does not return "Works" information.

    Do you have a suggestion about this?

         Chart.ChartProperties.Values['tooltip'] :=
           '{visible: true, format: "{0} :{1} "}';


    image.thumb.png.36fbf1a5e08f2849e5edc6e5afca7ebe.png
    *The sample project is attached.

    FSKendoUI_Test.zip 13.17 MB · 0 downloads

    @Marlon Nardi

    Greetings Marlon,
    Are you able to look into this matter?
    Thanks.

  7. Hi @Marlon Nardi

    Attached is your Kendo example, when you compile please open the pie chart because there is a problem there.

    I want to show the "Isler" field and "Amount" field information when the mouse is hovered over the chart in the pie chart.The data structure is as follows.

       with ClientDataSet1 do begin
         CreateDataSet;
         // Works, Quantity
         AppendRecord(['a ISI',1 ]);
         AppendRecord(['b ISI',3 ]);
         AppendRecord(['c ISI',5 ]);
         AppendRecord(['d ISI',7 ]);
         AppendRecord(['e ISI',9 ]);
    
       end;

    For example, I want to see the following result when Pie is hovered over the chart with the mouse. "a HEAT :1 "

    It should be with the code below, but "{0} field returns "Amount" information, while {1} field does not return "Works" information.

    Do you have a suggestion about this?

         Chart.ChartProperties.Values['tooltip'] :=
           '{visible: true, format: "{0} :{1} "}';


    image.thumb.png.36fbf1a5e08f2849e5edc6e5afca7ebe.png
    *The sample project is attached.

    FSKendoUI_Test.zip

  8. 4 hours ago, Sherzod said:

    Another solution:

    1. 

    procedure TMainForm.edtTeklifYuzdeChangeValue(Sender: TObject);
    begin
      //UniNumberEdit1.Value := edtTeklifYuzde.Value;
      //if edtTeklifYuzde.Value < 0 then
      //  UniNumberEdit1.Value := 0
      //else
      //  UniNumberEdit1.Value := edtTeklifYuzde.Value;
    end;

    2. 

    procedure TMainForm.edtTeklifYuzdeChange(Sender: TObject);
    begin
      UniNumberEdit1.Value := edtTeklifYuzde.Value;
    end;

    3. 

    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
      FDMemTable1.Append;
      FDMemTable1.Edit;
    
      with TUniNumberEdit(edtTeklifYuzde) do
      begin
        BlankValue := 0;
        AllowBlank := True;
      end;
    end;

     

    Hi @Sherzod

    I solved the problem with item 3. Thank you very much.

    This error occurred because I couldn't make edtOfferYuzde.BlankValue := 0; These standards should be added to the component specifications. @Farshad Mohajeri

  9. On 7/6/2018 at 1:24 PM, Sherzod said:

    Also you can try this:

    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
      UniNumberEdit1.JSInterface.JSAddListener('blur', 'function(me){if (Ext.isEmpty(me.value)) {me.setValue(0)}}');
    end;

    @Sherzod

     

     

    I am sending you an example.
    When you delete all the values in the above component, you will see the value of -1.

    * If the onchange feature is -1, do not say 0, after all, the user can give a value of -1.

    test02.zip

  10. Hi,

    The TUniDBFormattedNumberEdit component does not have a property where I can change the blankvalue.

    Calculations are wrong because it returns -1 if there is no value in the field.

    How do I make the value 0, which is -1 in case of blankvalue, when there is no data?

    When there is a blankvalue in the TUniDBFormattedNumberEdit component, it solves this problem by setting it to 0. What is the solution in DB component?

  11. 1 hour ago, Marlon Nardi said:

    Hi @pro_imaj

    I was unable to reproduce this problem with UniFSKendoUI version 1.1.2.95.

    Can you send me a simple example project? and check this problem for you.

    Thank you very much for your attention, I discovered that the problem is in the database structure. This error occurs when decimal in MSSQL. It gets fixed when you make the field type float. This is very interesting.

    Since there is a database problem, I cannot send it directly, but this is how I solved the problem for now.

    • Happy 1
  12. Hi,

    There is a UniDBLookupCombobox object inside the Hidden panel on Unigui Grid. I cannot access the information of the selected record with this object. I have been struggling for 3 hours.

    Methods I have tried.
    When I try to get data with UniDBLookupCombobox =>Onselected it shows wrong data.

    When I try to get data with Unigrid=>SetCellValue, the value that comes with valu does not work for me.

    What I want to do.
    Being able to get the ID of the selected record with the UniDBLookupCombobox I am not able to do that.

×
×
  • Create New...