1

(9 replies, posted in General)

Try Code

procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
WinHttpReq  : Variant;
url : String ;
body : TStringlist;
begin
    Try
        WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
        url := Form1.Edit6.Text ;
        body := Tstringlist.create ;
        body.add('{"chatId": "'+Form1.Edit4.Text+'","message": "'+Form1.Edit5.Text+'"}');
        WinHttpReq.Open('Post',url,False);
        WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
        WinHttpReq.Send(body.Text);
        Form1.Edit7.Text := WinHttpReq.StatusText ;
        Form1.Memo1.Text := WinHttpReq.ResponseText ;
        body.Free ;
        Except
    End;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.Edit6.Text :=
    Form1.Edit1.Text+'/waInstance'+Form1.Edit2.Text+'/sendMessage/'+Form1.Edit3.Text ;
end;
begin
end.

https://i.ibb.co/0RQm65vN/D20250529-T112502.png



Reference From https://green-api.com/en/docs/api/sending/SendMessage/

Delphi

program sendMessage;

{$APPTYPE CONSOLE}

uses
System.SysUtils,
System.Classes, System.Net.HttpClient, System.Net.URLClient, System.Net.HttpClientComponent;

var
HttpClient: TNetHTTPClient;
RequestBody: TStringStream;
RequestHeaders: TNetHeaders;
Response: IHTTPResponse;
EndpointURL, ID_INSTANCE, API_TOKEN_INSTANCE: string;

begin
ID_INSTANCE := '110100001';
API_TOKEN_INSTANCE := 'd75b3a66374942c5b3c019c698abc2067e151558acbd451234';

EndpointURL := 'https://api.greenapi.com/waInstance' + ID_INSTANCE + '/sendMessage/' + API_TOKEN_INSTANCE;

HttpClient := TNetHTTPClient.Create(nil);
RequestBody := TStringStream.Create('{ "chatId": "71234567890@c.us", "message": "test" }', TEncoding.UTF8);
RequestHeaders := [
    TNetHeader.Create('Content-Type', 'application/json')
];

try
    Response := HTTPClient.Post(EndpointURL, RequestBody, nil, RequestHeaders);

    if Response.StatusCode = 200 then
    Writeln('[Response]: ' + Response.ContentAsString)
    else
    Writeln('[ERROR ' + IntToStr(Response.StatusCode) + ']:' + Response.StatusText + '' + Response.ContentAsString);

    readln;
except
    on E: Exception do
    Writeln(E.ClassName, ': ', E.Message);
end;

HttpClient.Free;
RequestBody.Free;

end.

2

(9 replies, posted in General)

The example I made, is it the one you want?




https://i.ibb.co/s9QPNXjm/D20250528-T142607.png

How to Create procedure Or function
By Input Table name To Change Effect

-Form1
--TableGrid1
--TableGrid2
--TableGrid3



How To Edit Script ??????

procedure tb_red (nametable:TdbStringGridEx) ;
var
x,y : integer ;
t : String ;
Begin
t := nametable ;

     For  x := 0 To t.Columns.Count - 1 Do
     Begin
          For y := 0 To t.Rows.Count - 1 Do
          Begin
               t.Cells[x].Color := clRed ;
          End;     
     End;
End ;

I wil try code by
procedure Form1_TableGrid1_OnChange (Sender: TObject);
begin
tb_red (TableGrid1) ;
end;


Help Me Please

4

(4 replies, posted in Script)

Thank You sparrow


I Try Solution 1 Create a calculated field with the TEXT field type And Use Query Converter Text To Format It OK ...
But
Solution 2 tnxdatecolumn(Form1.TableGrid1.Columns[с]).formatmask := 'yyyy-mm-dd hh:mm:ss'
Nothing has changed
It would be great if you could show me a sample project.

5

(4 replies, posted in Script)

How To Change Format Datetime In TableGrid ???

https://i.ibb.co/BHvGcnkF/D20250501-T131013.png

6

(1 replies, posted in SQL queries)

How to Edit Script  Insert Line Break On SQLite ?
Code

SELECT 'A'||'\n'||'B'

Response

A\nB

----------


Code

SELECT 'A'||'\r'||'B'

Response

A\rB

----------


Code

SELECT 'A'||'\r\n'||'B'

Response

A\r\nB

----------


Code

SELECT 'A'||char(10)||'B'

Response

[Err] 1 - no such function: char

7

(3 replies, posted in Script)

+ Export Type
tqx=out:html: Export HTML
tqx=out:csv: Export CSV (Comma-Separated Values)
tqx=out:tsv: Export TSV (Tab-Separated Values)
tqx=out:tsv: Export Json (JavaScript Object Notation)

https://i.ibb.co/jvmkMYZc/D20250319-T102209.png


var
WinHttpReq : Variant;
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
url : string ;
ResponseText: string;
sl : TStringlist ;
Begin

    url := Form1.Edit4.Text ;
    Form1.Memo1.Lines.Clear ;
    WinHttpReq.SetTimeouts(10000, 10000, 10000, 10000);
    WinHttpReq.Open('GET',url, True);
    Try
        WinHttpReq.Send;
        WinHttpReq.WaitForResponse ;
        ResponseText := WinHttpReq.ResponseText;
        sl := TStringlist.Create ;
        sl.Text :=  ResponseText ;
        Form1.Memo1.Text := sl.text ;
        sl.Free;
        Except
        Form1.Memo1.Clear ;
        Showmessage('Error');
    End;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
url : string ;
gid : String ;
tqx : String ;
tq  : String ;
address : String ;
begin
    url :=  Form1.Edit1.Text ;
    gid :=  Form1.Edit2.Text ;
    tqx :=  Form1.ComboBox1.Text ;
    tq  :=  Form1.Edit3.Text ;
    address :=
    'https://docs.google.com/spreadsheets/d/'+url+
    '/gviz/tq?tqx='+tqx+
    '&gid='+gid+
    '&tq='+tq ;
    Form1.Edit4.Text :=  address ;
end;
begin
    WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
    Form1.ComboBox1.Items.Add('out:html');
    Form1.ComboBox1.Items.Add('out:csv');
    Form1.ComboBox1.Items.Add('out:tsv');
    Form1.ComboBox1.Items.Add('out:json');
    Form1.ComboBox1.ItemIndex:= 0;
end.

8

(3 replies, posted in Script)

abdou88 wrote:

Great idea... but can the project be improved?
1- Can the data be displayed in a grid table?

Processing, please wait. Creating a function to convert json to a table

Google Sheet Public >>> Get >>> Response Json


Referent
- Example Google Sheet : https://docs.google.com/spreadsheets/d/ … id=0#gid=0
- Reference How to use Google Sheets as a JSON Endpoint : https://www.freecodecamp.org/news/cjn-g … -endpoint/
- Basic Structure : https://docs.google.com/spreadsheets/d/[GOOGLE_SHEET_ID]/gviz/tq?tqx=out:json&tq&gid=[SHEET_GID]
- Google Visualization API Query Language : https://developers.google.com/chart/int … rylanguage

Example [QUERY_STRING] : tq
- Select All : Where+1=1
- Student Name = Anna : Where+A='Anna'
- Gender = Female : Where+B='Female'


https://i.ibb.co/7xXGVcfC/D20250314-T104645.png

10

(1 replies, posted in Script)

Thank You sparrow For Good Example
Good Job

11

(5 replies, posted in Script)

sparrow wrote:

Sorry for the advice
but I would like to advise you to read the documentation of the developers, on the topic of asynchronous mode
and other topics, before writing in the forum an alleged solution.
Gemini and Gemini Code Assist is just an adviser, not a surgeon.

Always welcome for advice, with love and respect. sparrow Good Friend

12

(5 replies, posted in Script)

sparrow wrote:

Set time-outs.
If time-outs are set, they must be set before open.

it doesn't work - Form1.TableGrid1.Cells[7,i] := 'Working' ;


Thank You  sparrow For recommend Good Code ..

Try Fix

Type Asynchronou

       WinHttpReq.SetTimeouts(10000, 10000, 10000, 10000);
       WinHttpReq.Open('GET',url, True);
       WinHttpReq.SetRequestHeader('Accept-Charset','UTF-8');

Or

Type synchronou

       WinHttpReq.SetTimeouts(10000, 10000, 10000, 10000);
       WinHttpReq.Open('GET',url, False);
       WinHttpReq.SetRequestHeader('Accept-Charset','UTF-8');

13

(5 replies, posted in Script)

+ Update Column Duration,Size taRightJustify
+ Update Column Duration,Size Name Value +' ms',+' bytes'
+ Update SetTimeouts 10 second

var
    WinHttpReq : Variant;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
    i : Integer ;
    url : String ;
    StartTime, EndTime: Tdatetime ;
    ResponseText: string;
    ResponseSize: Integer;
    ResponseStatus : Integer ;
    Duration: Double;
begin
    Form1.TableGrid1.Columns[5].Alignment :=  taRightJustify ;
    Form1.TableGrid1.Columns[6].Alignment :=  taRightJustify ;
    For i := 0 To Form1.TableGrid1.RowCount - 1 Do
    Begin                                          
        Form1.TableGrid1.ScrollToRow(i);
        Form1.TableGrid1.SelectedRow := i ;
        Form1.TableGrid1.Cells[7,i] := 'Working' ;
        StartTime := NOW;
        url := Form1.TableGrid1.Cells[1,i] ;
        WinHttpReq.Open('GET',url, False);
        WinHttpReq.SetRequestHeader('ContentEncoding','UTF-8');
        WinHttpReq.SetTimeouts(10000, 10000, 10000, 10000);
        Try
            WinHttpReq.Send;
            WinHttpReq.WaitForResponse ;
            ResponseText := WinHttpReq.ResponseText;
            ResponseSize := Length(ResponseText);
            ResponseStatus := WinHttpReq.Status ;
            EndTime := NOW ;
            Duration := (EndTime - StartTime) * 86400000;
            Form1.TableGrid1.Cells[2,i] := IntToStr(ResponseStatus);
            Form1.TableGrid1.Cells[3,i] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz',Starttime);
            Form1.TableGrid1.Cells[4,i] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz',Endtime);
            Form1.TableGrid1.Cells[5,i] := FormatFloat('0.00', Duration)+' ms' ;
            Form1.TableGrid1.Cells[6,i] := IntToStr(ResponseSize)+' bytes' ;
            Form1.TableGrid1.Cells[7,i] := 'OK' ;
            Except
            Form1.TableGrid1.Cells[7,i] := 'Error' ;
        End;
        Application.ProcessMessages ;
    End;
    Showmessage('Finnish!');
end;
begin
    WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
end.

Example List URL


| id   | url                                  |
| ---- | ------------------------------------ |
| 1    | https://drive.google.com             |
| 2    | https://www.dropbox.com              |
| 3    | https://onedrive.live.com            |
| 4    | https://mega.nz                      |
| 5    | https://www.pcloud.com               |
| 6    | https://icedrive.net                 |
| 7    | https://www.mediafire.com            |
| 8    | https://www.box.com                  |
| 9    | https://degoo.com                    |
| 10   | https://www.sync.com                 |
| 11   | https://www.infomaniak.com/en/kdrive |
| 12   | https://disk.yandex.com              |
| 13   | https://koofr.eu                     |
| 14   | https://internxt.com                 |
| 15   | https://www.zippyshare.com           |
| 16   | https://upload.ee                    |
| 17   | https://www.filefactory.com          |
| 18   | https://rapidgator.net               |
| 19   | https://uptobox.com                  |
| 20   | https://www.4shared.com              |
| 21   | https://www.sendspace.com            |
| 22   | https://www.terabox.com              |
| 23   | https://wetransfer.com               |
| 24   | https://anonfiles.com                |
| 25   | https://file.io                      |
| 26   | https://uploadfiles.io               |
| 27   | http://send.firefox.com              |
| 28   | https://transferxl.com               |
| 29   | https://fromsmash.com                |
| 30   | https://gofile.io                    |
| 31   | https://filetransfer.io              |
| 32   | https://www.jetdrop.com              |
| 33   | https://tresorit.com/send            |
| 34   | https://wormhole.app                 |
| 35   | https://send-anywhere.com            |
| 36   | https://sharedrop.io                 |
| 37   | https://volafile.org                 |
| 38   | https://catbox.moe                   |
| 39   | https://bayfiles.com                 |
| 40   | https://pixeldrain.com               |
| 41   | https://ufile.io                     |
| 42   | https://send.cm                      |
| 43   | https://onsen.io                     |
| 44   | https://www.swisstransfer.com        |
| 45   | https://www.justbeamit.com           |
| 46   | https://www.filemail.com             |
| 47   | https://www.jumbomail.me             |
| 48   | https://dropmefiles.com              |
| 49   | https://sendgb.com                   |
| 50   | https://www.filedropper.com          |
| 51   | https://tinyupload.com               |

14

(5 replies, posted in Script)

Main Key : Send API By  WinHttp.WinHttpRequest.5.1
https://i.ibb.co/JjdcYKpQ/D20250312-T105820.png


Example Code

var
WinHttpReq : Variant;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
i : Integer ;
url : String ;
StartTime, EndTime: Tdatetime ;
ResponseText: string;
ResponseSize: Integer;
ResponseStatus : Integer ;
Duration: Double;
begin
    Form1.TableGrid1.Columns[5].Alignment :=  taRightJustify ;
    Form1.TableGrid1.Columns[6].Alignment :=  taRightJustify ;
    For i := 0 To Form1.TableGrid1.RowCount - 1 Do
    Begin
        Form1.TableGrid1.ScrollToRow(i);
        Form1.TableGrid1.SelectedRow := i ;
        Form1.TableGrid1.Cells[7,i] := 'Working' ;
        StartTime := NOW;
        url := Form1.TableGrid1.Cells[1,i] ;
        WinHttpReq.Open('GET',url, False);
        WinHttpReq.SetRequestHeader('ContentEncoding','UTF-8');
        Try
            WinHttpReq.Send;
            WinHttpReq.WaitForResponse ;
            ResponseText := WinHttpReq.ResponseText;
            ResponseSize := Length(ResponseText);
            ResponseStatus := WinHttpReq.Status ;
            EndTime := NOW ;
            Duration := (EndTime - StartTime) * 86400000;
            Form1.TableGrid1.Cells[2,i] := IntToStr(ResponseStatus);
            Form1.TableGrid1.Cells[3,i] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz',Starttime);
            Form1.TableGrid1.Cells[4,i] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz',Endtime);
            Form1.TableGrid1.Cells[5,i] := FormatFloat('0.00', Duration)+' ms' ;
            Form1.TableGrid1.Cells[6,i] := IntToStr(ResponseSize)+' bytes' ;
            Form1.TableGrid1.Cells[7,i] := 'OK' ;
            Except
            Form1.TableGrid1.Cells[7,i] := 'Error' ;
        End;
        Application.ProcessMessages ;
    End;
    Showmessage('Finnish!');
end;
begin
    WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
end.




Note
- Gemini  And  Gemini Code Assist Help Edit Code and Show List Domain Name

15

(1 replies, posted in Script)

I Try Create Log
have Row More Than  10,000,000 Record On TableGrid per Day
IF record + 1 >>>> 10,000,001

1. Append data Last Row Only
Compare
2. Insert data First Row Only

It takes more time to run ???

1. Append data Last Row Only
Form1.tb_api_log.AddRow(1);
Form1.tb_api_log.Cells[  0,Form1.tb_api_log.RowCount   ]:= NOW() ;
2. Insert data First Row Only
Form1.tb_api_log.InsertRow(0,1);
Form1.tb_api_log.Cells[0,0]:= NOW() ;

Example Code

procedure Form1_Button3_OnClick (Sender: TObject; var Cancel: boolean);
var
max_row : Integer ;
time_start, time_end: Cardinal;
time_use: Double;
begin
    max_row := Form1.TableGrid1.RowCount ;
    time_start := GetTickCount;
    Form1.TableGrid1.InsertRow(0,1);
    Form1.TableGrid1.ScrollToRow(0) ;
    Form1.TableGrid1.Cells[0,0] := IntToStr(max_row+1 ) ;
    Form1.TableGrid1.Cells[1,0] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', NOW);
    Form1.TableGrid1.Cells[2,0] := IntToHex(max_row+1,8) ;
    Form1.TableGrid1.Cells[3,0] := StrToMD5(IntToHex(max_row+1,8));
    time_end := GetTickCount;
    time_use := time_end - time_start;
    Form1.TableGrid1.Cells[4,0] := FloatToStr(time_use) ;
    Application.ProcessMessages ;
end;
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
max_row : Integer ;
time_start, time_end: Cardinal;
time_use: Double;
begin
    time_start := GetTickCount;
    max_row := Form1.TableGrid1.RowCount ;
    Form1.TableGrid1.AddRow(1);
    Form1.TableGrid1.ScrollToRow(max_row) ;
    Form1.TableGrid1.Cells[0,max_row] :=  IntToStr(max_row+1 ) ;
    Form1.TableGrid1.Cells[1,max_row] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', NOW);
    Form1.TableGrid1.Cells[2,max_row] := IntToHex(max_row+1,8) ;
    Form1.TableGrid1.Cells[3,max_row] := StrToMD5(IntToHex(max_row+1,8));
    time_end := GetTickCount;
    time_use := time_end - time_start;
    Form1.TableGrid1.Cells[4,max_row] := FloatToStr(time_use) ;
    Application.ProcessMessages ;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
Var
i : Integer ;
time_start, time_end: Cardinal;
time_use: Double;
begin
    Form1.TableGrid1.dbSQL  := 'SELECT "" AS Event,"" as DateTime,"" as Character,"" as MD,"" Duration';
    Form1.TableGrid1.dbSQLExecute ;
    Form1.TableGrid1.ClearRows ;
    For i := 0 To 9999  Do
    Begin
        Form1.TableGrid1.ScrollToRow(i) ;
        time_start := GetTickCount;
        Form1.TableGrid1.InsertRow(0,1);
        Form1.TableGrid1.Cells[0,0] := IntToStr(i+1) ;
        Form1.TableGrid1.Cells[1,0] := FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', NOW);
        Form1.TableGrid1.Cells[2,0] := IntToHex(i+1,8) ;
        Form1.TableGrid1.Cells[3,0] := StrToMD5(IntToHex(i+1,8));
        time_end := GetTickCount;
        time_use := time_end - time_start;
        Form1.TableGrid1.Cells[4,0] := FloatToStr(time_use) ;
        Application.ProcessMessages ;
    End;
end;
begin
end.

16

(1 replies, posted in Script)

From Data Type http://www.delphibasics.co.uk/ByFunction.php?Main=Types

If Wil Use  Type AnsiString Or AnsiChar  How To Use Similar Type In MVD ?
For Send  Image Data API Internet

| UseInMVD | Var             |
| :------- | :-------------- |
|          | AnsiChar        |
|          | AnsiString      |
| OK       | Array           |
| OK       | Boolean         |
| OK       | Byte            |
| OK       | Cardinal        |
| OK       | Char            |
|          | Class           |
|          | Comp            |
| OK       | Currency        |
| OK       | Double          |
| OK       | Extended        |
|          | File            |
| OK       | Int64           |
| OK       | Integer         |
| OK       | LongInt         |
|          | LongWord        |
|          | PAnsiChar       |
|          | PAnsiString     |
|          | PChar           |
|          | PCurrency       |
|          | PDateTime       |
|          | PExtended       |
|          | PInt64          |
| OK       | Pointer         |
|          | PShortString    |
|          | PString         |
|          | PVariant        |
|          | PWideChar       |
|          | PWideString     |
| OK       | Real            |
|          | Real48          |
|          | Record          |
|          | ShortInt        |
|          | ShortString     |
| OK       | Single          |
|          | SmallInt        |
| OK       | String          |
|          | TConvFamily     |
|          | TConvType       |
| OK       | TDateTime       |
|          | Text            |
|          | TextFile        |
|          | TFloatFormat    |
|          | TFormatSettings |
| OK       | TObject         |
|          | TPoint          |
|          | TRect           |
|          | TReplaceFlags   |
|          | TSearchRec      |
|          | TSysCharSet     |
|          | TThreadFunc     |
| OK       | Variant         |
|          | WideChar        |
|          | WideString      |
| OK       | Word            |

17

(2 replies, posted in Script)

How Insert Calculator Integration  On Form MVD seamless
and result to Textbox when  press finish

https://i.ibb.co/mCsxtRPP/D20250225-T143800.png

18

(3 replies, posted in Script)

How To Edit Script  Remove 

Save Password ☑

Stat Dialog connect MySQL

or
Save Password Visible := False ?

https://i.ibb.co/ZfRYc8x/D20250116-T144005.png

19

(3 replies, posted in General)

Try

var
  WinHttpReq  : Variant;
  url : String ;
begin
  WinHttpReq  := CreateOleObject('WinHttp.WinHttpRequest.5.1');
  url := 'https://checkupdate-xi3tiqz4rq-uc.a.run.app/?prg=sangkapp' ;
  WinHttpReq.open('GET',url,false);
  WinHttpReq.SetRequestHeader('Connection','keep-alive');
  WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
  WinHttpReq.SetRequestHeader('ContentEncoding','UTF-8');
  WinHttpReq.send;
  Showmessage( 'Status = '+ #13#10 +IntToStr(WinHttpReq.Status) + #13#10 +'ResponseText ='+ #13#10 + WinHttpReq.ResponseText) ;
end;

Try

IF WinHttpReq.Status = 200 
Then 
Showmessage(WinHttpReq.ResponseText)
Else Showmessage('Error') ;
sparrow wrote:

Hi,
Something like this


procedure OnDblClick(Sender: TObject);
var
  i: integer;
  tli: TListItems;
begin
  tli := listview.items;
  for i:=0 to tli.count - 1 do
  begin
    if tli.item[i].selected then showmessage(tli.item[i].caption);
  end;
end;

begin
...
listview.OnDblClick := @OnDblClick;
end.

OK It Work Thank You sparrow

IF i Will Show Column2 , Column3
How To Edit Code ?

https://i.ibb.co/DG2K7wX/D20240723-T095045.png

Download
https://myvisualdatabase.com/forum/misc … download=1

How to Sort Order by Name value in JSonArray and add to Memo1


Example

[
    {
        "Name": "Cat",
        "Color": "White"
    },
    {
        "Name": "Ant",
        "Color": "Red"
    },
    {
        "Name": "Zebar",
        "Color": "Black"
    }
]

I will To result

Ant,Red
Cat,White
Zebar,Black






------------------------------------------------------------

Try Easy Code But  Result  Not Order By Name

Cat,White
Ant,Red
Zebar,Black

How To Edit Code ???

procedure MyProcedure();
var
JsonArray : TJsonArray  ;
i         : Integer     ;
JS_temp   : TJsonObject ;
js_name   : TJsonString ;
js_color  : TJsonString ;
begin
    JsonArray := TJsonArray.ParseJSONValue(
    '[
    {
        "Name": "Cat",
        "Color": "White"
    },
    {
        "Name": "Ant",
        "Color": "Red"
    },
    {
        "Name": "Zebar",
        "Color": "Black"
    }
    ]'
    );
    for i := 0 to JsonArray.Size -1 do
    begin
        js_temp := TJSONObject (TJSONObject(JsonArray.Get(i))) ;
        js_name := TJSONString(JS_temp.GetPairByName('balance').JsonValue);
        js_color := TJSONString(JS_temp.GetPairByName('color').JsonValue);
        Form1.Memo1.Lines.add(js_name.Value+','+js_color.Value)
    end;
end;

23

(4 replies, posted in Script)

jean.brezhonek wrote:

Oups I've forgotten the snippet
JB


Thank  JB Script It

procedure frmEmployee_OnClose (Sender: string; Action: string);
var     i,c: integer;
begin
    c := frmEmployee.ComponentCount-1;
    for i := 0 to c do
    begin
        if frmEmployee.Components[i] is TdbEdit then TdbEdit(frmEmployee.Components[i]).Clear;       //  Dans le cas d'un TEdit
        if frmEmployee.Components[i] is TdbMemo then TdbMemo(frmEmployee.Components[i]).Clear;       //  Dans le cas d'un TMemo
    end;
end;
JB

✓ Check IF TdbEdit >>> Clear Thank you JB

Um..... And IF
1. TdbEdit ✓
2. copy(Component_Name,5,Length(Component_Name)) MOD 2 = 0
How Do Edit Scipt ???

Form1.Edit1.Text
Form1.Edit2.Clear // Because (1. TdbEdit)+ (2. Component_Name MOD 2 = 0)
Form1.Edit3.Text
Form1.Edit4.Clear // Because (1. TdbEdit)+ (2. Component_Name MOD 2 = 0)

24

(4 replies, posted in Script)

I want to clear multiple edit boxes using the Loop method to reduce the number of lines in scripting.
Normally I write

Form1.Edit1.Clear ;
Form1.Edit2.Clear ;
Form1.Edit3.Clear ;
Form1.Edit4.Clear ;
Form1.Edit5.Clear ;
Form1.Edit6.Clear ;
Form1.Edit7.Clear ;
Form1.Edit8.Clear ;
Form1.Edit9.Clear ;
Form1.Edit10.Clear;

But if I want to write a Loop?

For i := 1 To 10 do
  begin
    Form1.Edit[i].Clear ; // How To Edit Script 
  end;

Help Me Please ?

25

(8 replies, posted in Script)

sparrow wrote:
prahousefamily wrote:
sparrow wrote:

Could you please attach the project or test project and the import file.


- option
1. Declare variables within procedures only.
2. Do not declare variables that are Public.


Unfortunately, I don’t yet see a solution in MVD with such requirements. Global variables are needed to save the state of variables in a procedure (loop), otherwise the process will start from the state of the variable that is defined in the procedure.
Of course, you can do as you did in the example with the Excel file name, remembering state variables in invisible Edit on the form. But this is a kind of analogue of a global variable.



IF Declare variables are Public.
Can Start/Stop/Continue ?