Jump to content

Ian Branch

Members
  • Content Count

    1434
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Ian Branch

  1. Ian Branch

    Some REST help please.

    Correction! I thought it had been successful in the Debugger but I was looking in the wrong place. 😞 Still an Empty Request error. This is the Debugger Request Tab: This is the Parameters Tab, with key info changed: 😉 You will note the 'Response' says 200:OK..... But the Tabular Data Tab says it was an error. I spoke to the Phone owner and he hasn't received any messages. I'm confused. Ian
  2. Ian Branch

    Some REST help please.

    Hi Patrick, When I put the Parameters into the REST Debugger, it says it is successful. When I have the parameters in the RESTRequest and right-click|Run, it is successful. But, If I leave The Client and Request exactly the same and inthe Delphi App do RESTRequest1.Execute, it fails. 😞 procedure TForm12.btnComponentsClick(Sender: TObject); var obj, code, data: TJSONObject; sCode, url: string; begin // // Call the REST API and handle the response RESTRequest1.Execute; // ShowMessage('Status Code = ' + RESTResponse1.StatusCode.ToString); obj := RESTResponse1.JSONValue as TJSONObject; scode := obj.Values['code'].Value; data := obj.Values['data'] as TJSONObject; url := data.Values['text'].Value; ShowMessage('Code = ' + scode + sLineBreak + 'Text = ' + url); end; Returning 'Status Code = 200' for the first ShowMessage, and 'Code = 302 Text = Empty Request.....' for the second showmessage. 😞 Regards, Ian
  3. Ian Branch

    Some REST help please.

    So, I got test parameters from Vodafone. When I run the App I get a 'Empty Request...' message. Clearly I have missed setting something. 😞 Ian
  4. Ian Branch

    Some REST help please.

    Hi Team, I'm back. Thank you for your inputs. I have this so far: procedure TForm12.Button1Click(Sender: TObject); begin // // The RESTClient has already been configured. // RESTRequest1.AddParameter('username', 'email@email.com'); RESTRequest1.AddParameter('secret', 'password'); RESTRequest1.AddParameter('shortcode', 'pacificbulksms'); RESTRequest1.AddParameter('msisdn', '6799998122'); // I take it this is the destination mobile Phone #?? RESTRequest1.AddParameter('message', 'Hello World'); // Call the REST API and handle the response RESTRequest1.Execute; // Access the response content if RESTResponse1.StatusCode = 200 then begin // Process the response content (e.g., RESTResponse.Content) var sResponse := RESTResponse1.Content; Label1.Caption := sResponse; // // Example response {"result":"success","code":"200","data":{"text":"SMS sent successfully."}} var sResult := GetResponseParameters(sResponse, 3, 4); var sCode := GetResponseParameters(sResponse, 7, 8); var sMessage := GetResponseParameters(sResponse, 13, 14); end else begin // Handle error cases end; // end; The RESTClient has the BaseURL set as "https://pacificbulksms.com". The RESTRequest has the Resource set as "api/restJson". Are there any other default settings I need to change, or settings I need to make? Aside of course getting actual usable test parameters from Vodaphone. 😉 Regards & TIA, Ian
  5. Ian Branch

    What am I missing here??

    Hi Team, I am trying to assign the AfterEdit event to a TTable. I have this in the private area: procedure jtAfterEdit(Sender: TOBject); I have this in the DatamoduleCreate; JobTickets.AfterEdit := JTAfterEdit; And this as jtAfterEdit: procedure TdmC.JTAfterEdit(Sender: TOBject); begin // JobTickets.FieldByName('UserID').AsString := AUD.UserID; lNewRecord := False; // Specifically reset the flag. // end; Delphi tells me that "[dcc32 Error] dmCurrent.pas(861): E2010 Incompatible types: 'TDataSet' and 'TObject'" for this line: JobTickets.AfterEdit := JTAfterEdit; What have I missed pls? Regards & TIA, Ian
  6. Ian Branch

    What am I missing here??

    Tks Thomas. Changing "Sender: TObject" to "Dataset: TDataset" did the trick. Regards & Tks again, Ian
  7. Ian Branch

    Some REST help please.

    Hi Team, I haven't forgotten this, just dealing with some issues for a Customer.
  8. Ian Branch

    Credit Card Bank Fee and VAT/GST?

    Hi Team, In some places, not all, the use of a Credit Card to pay by a Customer incurs a 'Bank Fee' on the Seller. The Seller offsets this by adding an appropriate 'Bank Fee' to the sale. Question - Where VAT/GST applies, the Sale will incur a VAT/GST as part of the Sell Price. Does the 'Bank Fee' also incur the VAT/GST? What is the general experience/knowledge? Regards & TIA, Ian
  9. Ian Branch

    Feedback Request - FastReports vs ReportBuilder?

    In my early Delphi days I used FastReport however at that time it didn't/couldn't do what i needed so I moved to ReportBuilder. Since then I have never seen or come across a reason to look for another report engine. Ian
  10. Hi Team, I redid my routine to use StrCmpLogicalW. Now I get... uses System.Generics.Defaults; procedure SortStringArray(var AStringArray: TArray<string>); var Comparer: IComparer<string>; begin Comparer := TComparer<string>.Construct( function(const ALeft, ARight: string): Integer begin Result := StrCmpLogicalW(PChar(ALeft.ToLower), PChar(ARight.ToLower)); end ); // Sort the string array using the custom comparer TArray.Sort<string>(AStringArray, Comparer); end; Regards & Tks. Ian
  11. Hi Team, I have been following this thread because I have a need. What would be the correct natural sort order for these? 'file10.txt', 'File2.txt', '2fileb.txt', 'file1.txt', '1FileA.txt', 'file20.txt', '12fiLe.txt', 'file11.txt', '10file.txt' Is there a reference for dictating Natural Sort Order rules? I have my own StringArray Natural Sorting routines and they seem to work. I just want to make sure they are giving me the correct result IAW NSO rules. This is what I am producing att: Regards & TIA, Ian
  12. Hi Team, D11.3. Is there a way to pickup the number at build/compile time so I can include it in a log message? e.g. something like..LogMessage('This is line # '+%LineNumber%); I know I can hard code it but it would need to be re-done every time there is a code change. Regards & TIA, Ian
  13. Ian Branch

    Line number at build/compile time??

    I did say Tks = Thanks.
  14. Ian Branch

    Line number at build/compile time??

    Excellent! Tks p2k.
  15. Ian Branch

    Upgrading from 11.2 to 11.3

    I Third that...
  16. "Intelligence" - I think, therefore I am..
  17. Ian Branch

    App Tethering issue..

    Hi Team, Despite my pitiful efforts I have managed to get App Tethering working between two Apps. But, I have a problem. IIUC, the Sender has to be running before the Receiver. Something about establishing a socket This I can't guarantee. 😞 Is there any way to configure App Tethering so it dosn't matter if the Sender or Receiver starts first?? Regards & TIA, Ian
  18. Hi Guys, D11.3.1. This is what I understand att. Feel free to correct me if my understanding is incorrect. 1. If I set FormatSettings with a Country code, i.e. "var FormatSettings := TFormatSettings.Create('en-AU');", then that action will configure the various TFormatSettings properties in SysUtils to the Australian formats. 2. I can then forget about the variable FormatSettings. 3. Having set these properties in SysUtils, whatever Unit has SysUtils will have/use the set properties. 4. Any function/procedure that uses a FormatSettings property will now use the relevant set TFormatSettings property according to the Country/Region code employed in the '.Create()'. Are my understandings correct? Regards & TIA, Ian
  19. Ian Branch

    Setting & Usage of TFormatSettings..

    Ahhh. Tks for the tip. That was always a/the risk. Won't happen. Tks to all for your inputs and guidance. Regards, Ian
  20. Ian Branch

    Setting & Usage of TFormatSettings..

    Hi Dalija, Thank you for your input. Appreciated. Have you ever worked with Pacific Islanders? I have been dealing with them for the past 7 years and they can be extremely frustrating. They will do things with their PC just because. Including changing their date & time formats. and in a couple of cases their Region. My Customer wants all the Apps to operate to a standard format, interestingly, to en-AU, despite what the User may have done with his/her PC. I thought this would be a good way to enforce it. Regards, Ian
  21. Ian Branch

    NormalizedLocaleName??

    Hi Team, Win 11, D11.3.1. I am playing around with TFormatsettings and I am using this Emba code.. procedure Test; var str1, str2: string; FS: TFormatSettings; strResult, strFormat: TStringBuilder; begin strResult := TStringBuilder.Create; strFormat := TStringBuilder.Create; FS := TFormatSettings.Create('en-AU'); strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]); str1 := FormatDateTime(strFormat.ToString, Now()); strResult.AppendLine('1.'+str1); ShowMessage(FS.NormalizedLocaleName); strResult.AppendLine(FS.NormalizedLocaleName); //A second instance with a different locale (used for comparison) FS := TFormatSettings.Create('ro-RO'); strFormat.Clear; strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]); str2 := FormatDateTime(strFormat.ToString, Now()); strResult.AppendLine('2.'+str2); strResult.AppendLine(FS.NormalizedLocaleName); ShowMessage(strResult.ToString); // end; What should FS.NormalizedLocaleName return? Emba Help says a string but I am getting nothing back. Or maybe I am and it is blank. Not expected. Regards & TIA, Ian
  22. Ian Branch

    NormalizedLocaleName??

    Hi p2k, I didn't really know what to expect, although I thought it might be, in my case, Australia.
  23. Ian Branch

    Open IDE in DPI Unaware??

    Hi Team, D11.3.1. Win 11. When I double click on a Delphi file in Windows Explorer, it opens in Delphi IDE in DPI Aware mode. Is there someway to make Windows or Delphi open the IDE in DPI Unaware mode when I double click on a Delphi file fromthe File Explorer? Regards & TIA, Ian
  24. Ian Branch

    Open IDE in DPI Unaware??

    Yup it works, but it isn't perfect, yet. 😉
  25. Ian Branch

    NormalizedLocaleName??

    p2k, I was just experimenting with Formatsettings and came across this that gave me nothing. Ian
×