HOw pulling data from TCP Connection?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
HOw pulling data from TCP Connection?
I'm trying to get Data from Race Timing System (Elite V3 Software)
which is this data will sent by "Elite V3 Sofware" periodically
Then i'm buld Client software with TCP connection
I've succeeded connect "Elite V3 Software" and Data sent to Livecode Client into my Log
Data sent periodically into a text field
this data on log sent would be like this
***** PASING BEGIN *****
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
***** PASING END *****
(*Separe by
What i'm asking is
Could we pulling this data every time Passing begin
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
and put it into Data Grid
Comment and Help would be appreciate
Best Regards
Gilar Kadarsah
which is this data will sent by "Elite V3 Sofware" periodically
Then i'm buld Client software with TCP connection
I've succeeded connect "Elite V3 Software" and Data sent to Livecode Client into my Log
Data sent periodically into a text field
this data on log sent would be like this
***** PASING BEGIN *****
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
***** PASING END *****
(*Separe by
What i'm asking is
Could we pulling this data every time Passing begin
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
and put it into Data Grid
Comment and Help would be appreciate
Best Regards
Gilar Kadarsah
Gilar | from INDONESIA
Re: HOw pulling data from TCP Connection?
Hi Gilar,
if the date will go into a field then you could maybe use the "textchanged" message in the field?
Out of my head, script of text field:
If that is not what you want, please explain.
Best
Klaus
if the date will go into a field then you could maybe use the "textchanged" message in the field?
Out of my head, script of text field:
Code: Select all
on textchanged
## Ignore first and last line:
put line 2 to -2 of me into tData
replace ";" with TAB in tData
set the dgText of grp "Your datagrid here" to tData
end textchanged
Best
Klaus
Re: HOw pulling data from TCP Connection?
Hi Klause .... Thank you for replay
On TextChanged seem not works form me ....
As far as I know, ontextchanged will apply when we type something on text field
then script will work. Please corect me if i'm wrong.
this message is automatically put by TCP connection into a text field
***** PASING BEGIN *****
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
***** PASING END *****
and also i want to know if client received message 2,3, or 4 times
Can i use this code
I mean the message on Log (a textfield)
would be like this
On TextChanged seem not works form me ....
As far as I know, ontextchanged will apply when we type something on text field
then script will work. Please corect me if i'm wrong.
this message is automatically put by TCP connection into a text field
***** PASING BEGIN *****
1;2A;GILAR KADARSAH;2;345.56;2;50
2;7B;FAJAR RIFAI;3;112.23;1;76
***** PASING END *****
and also i want to know if client received message 2,3, or 4 times
Can i use this code
Code: Select all
## Ignore first and last line:
put line 2 to -2 of me into tData
would be like this
Code: Select all
***** PASING BEGIN *****
2A;GILAR KADARSAH;1;50.256
7B;FAJAR RIFAI;1;51.123
***** PASING END *****
***** PASING BEGIN *****
2A;GILAR KADARSAH;2;51.457
7B;FAJAR RIFAI;2;52.012
***** PASING END *****
***** PASING BEGIN *****
2A;GILAR KADARSAH;3;53.225
7B;FAJAR RIFAI;3;54.021
***** PASING END *****
Gilar | from INDONESIA
Re: HOw pulling data from TCP Connection?
Hi Gilar,
Then use the handler which writes the data to the field to "trigger" your action.
Klaus (with no E!)
sigh...Klause
Yes, true, sorry, my fault.On TextChanged seem not works form me ....
As far as I know, ontextchanged will apply when we type something on text field
then script will work. Please correct me if i'm wrong.
Then use the handler which writes the data to the field to "trigger" your action.
Count the "#### Begin..." lines:and also i want to know if client received message 2,3, or 4 times
Best...
put fld "whatever" into tData
filter tData with "***** PASING BEGIN *****"
answer" User received message" &&the num of lines of tData && "times."
...
Klaus (with no E!)
Re: HOw pulling data from TCP Connection?
Hi Klaus ..... Thanks for Quick Replay...
Then i'll try of what you say ... doing some trial and error too.
Thanks for guiding me into right direction.
God bless you ...
Then i'll try of what you say ... doing some trial and error too.
Thanks for guiding me into right direction.
God bless you ...
Gilar | from INDONESIA
Re: HOw pulling data from TCP Connection?
Hi ... Klaus
FYI, my Livecode Client only receive Data from Elite. and I can not manipulate Incoming text on Log.
Imagine a race ......
We have about 20-30 racer
And we put a transponder into every racer
Then when the racer passes our detector,
Transponder will send data into Race Timing System and
then sent it into Livecode Client.
This is the Data which sent by Racer (Transponder)
On Livecode Client LOG (a text field)
This data is always change (dynamic), the text will increase, NOT replace the old one.
data will incoming ... incoming ... incoming again
this is the original Data which copied from Livecode Client.
After livecode client received data from Racer (Transponder)
I have to put it into DataGrid again ... and again ... and again
Any idea how to filter and grab it it ...
Sorry for my English and hope you could understand what i mean....
I'll explain more if necessary ...
Best Regards
Gilar Kadarsah
Sorry could you explain more about this. or give an examlpe.Then use the handler which writes the data to the field to "trigger" your action.
FYI, my Livecode Client only receive Data from Elite. and I can not manipulate Incoming text on Log.
Sorry, It seem is not what i need... maybe a litle bit miss understand....
put fld "whatever" into tData
filter tData with "***** PASING BEGIN *****"
answer" User received message" &&the num of lines of tData && "times."
...
Imagine a race ......
We have about 20-30 racer
And we put a transponder into every racer
Then when the racer passes our detector,
Transponder will send data into Race Timing System and
then sent it into Livecode Client.
This is the Data which sent by Racer (Transponder)
Code: Select all
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
13A;OKTAVIANO RIZQY;1;33393
*** PASSINGS END ***
This data is always change (dynamic), the text will increase, NOT replace the old one.
data will incoming ... incoming ... incoming again
this is the original Data which copied from Livecode Client.
Code: Select all
*** MESSAGE BEGIN ***
06:23:18>GREEN FLAG
*** MESSAGE END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;0;0;600000;10;GREEN FLAG;636715525985245868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** FOLDER INFORMATION BEGIN ***
86ef01c3-43f6-44e2-84d5-302a06857e8c;SENTUL INTL CIRCUIT - BOGOR (3.95 km)
0;1;1;0;1;1;0;2;1;;;;;;
;;;;0;;;;;0;;;;;0;;;;;0;;;;;0;;;;;0;;;;;0;;;;;0;;;;;0;;;;;0
*** FOLDER INFORMATION END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;5008;0;594992;10;GREEN FLAG;636715526035325868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;5008;1;594992;10;GREEN FLAG;636715526035325868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
1A;WAHYU NUGROHO;1;2459
*** PASSINGS END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
2A;MUHAMMAD SAIRAJI;1;6425
*** PASSINGS END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;11000;1;589000;10;GREEN FLAG;636715526095245868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
4A;M. GILANG AKBAR ROLAND;1;9295
*** PASSINGS END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
6A;BONE FIZER MIOLO;1;13204
*** PASSINGS END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;16995;1;583005;10;GREEN FLAG;636715526155195868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
8A;NIA RAMADHANI;1;16427
*** PASSINGS END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;22996;1;577004;10;GREEN FLAG;636715526215205868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
7A;ADITYA DWI CAHYADI;1;19954
*** PASSINGS END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;28992;1;571008;10;GREEN FLAG;636715526275165868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;34986;1;565014;10;GREEN FLAG;636715526335105868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
13A;OKTAVIANO RIZQY;1;33393
*** PASSINGS END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;39991;1;560009;10;GREEN FLAG;636715526385155868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** RACE INFORMATION BEGIN ***
WARM UP;11. ALL NEW R15 IDEMITSU JUNIOR PRO;43986;1;556014;10;GREEN FLAG;636715526425105868;86ef01c3-43f6-44e2-84d5-302a06857e8c;b2d03d9d-e3d6-4d7c-924c-0ab42a21ad8f;0;YELLOW TURN
*** RACE INFORMATION END ***
*** RESULTS BEGIN *** (20)
Numero;Nom;TotalNbTour;TotalTpsCumule;TpsPiste;TriMulti;Groupe;Categorie;Classe
1A;WAHYU NUGROHO;1;2459;2459;;YMH YAMALUBE NHK IRC DID NISSIN NGK BAHTERA RT;JATENG;
2A;MUHAMMAD SAIRAJI;1;6425;6425;;BOB's R7 RACING SCHOOL;;
4A;M. GILANG AKBAR ROLAND;1;9295;9295;;YMH ADITAMA ANTASARI STICKER RT;KALTIM;
6A;BONE FIZER MIOLO;1;13204;13204;;HENDRIANSYAH RACING SCHOOL;DKI;
8A;NIA RAMADHANI;1;16427;16427;;N'RPM YAMAHA ALFA SCORPII NHK IRC;SUMUT;
7A;ADITYA DWI CAHYADI;1;19954;19954;;D45 RACING ACADEMY;JATIM;
13A;OKTAVIANO RIZQY;1;33393;33393;;REY RACING SCHOOL;DKI;
3A;MUHAMAD ANDRIAS LUKITO;0;2000000000;0;;YMH YAMALUBE ORYZA NISSIN IRC DID KYT;JATENG;
5A;ARYASENA ARJUNA SETYAJI;0;2000000000;0;;REY RACING SCHOOL;JABAR;
9A;SEPTA PUTRA EKA JATI;0;2000000000;0;;REY RACING SCHOOL;;
10A;CANDRA HERMAWAN;0;2000000000;0;;PUJI RAHAYU MELINDO EDOMIX D45 RACING ACADEMY;JATIM;
11A;MUHAMMAD RESKI AWAL;0;2000000000;0;;BOB's R7 RACING SCHOOL;SULSEL;
12A;MUHAMMAD FAIZ ZULFIKAR;0;2000000000;0;;BOB's R7 RACING SCHOOL;KALTIM;
14A;KIKI ARANXA;0;2000000000;0;;BOB's R7 RACING SCHOOL;JATIM;
15A;FAHMI BASAM;0;2000000000;0;;YAMAHA PRS OYEHE NABIRE;SULSEL;
16A;MUHAMAD ILHAM EFENDI;0;2000000000;0;;D45 RACING ACADEMY;JATENG;
17A;MOHD SILMI HELSINKY;0;2000000000;0;;BOB's R7 RACING SCHOOL;ACEH;
18A;ANDI MAHMUD MAPPEGANTI Y;0;2000000000;0;;AKAIJAYA RT;SULTENG;
19A;MUHAMMAD RIDWAN;0;2000000000;0;;REY RACING SCHOOL;JABAR;
20A;M IRGI SEPTDAJI PUTRA;0;2000000000;0;;REY RACING SCHOOL;JABAR;
*** RESULTS END ***
I have to put it into DataGrid again ... and again ... and again
Any idea how to filter and grab it it ...
Sorry for my English and hope you could understand what i mean....
I'll explain more if necessary ...
Best Regards
Gilar Kadarsah
Gilar | from INDONESIA
Re: How pulling data from TCP Connection?
Hi Gilar,
What exactly do you need to count?
We now have "MESSAGE", "PASSING", "FOLDER INFORMATION", "RESULTS" and "RACE INFORMATION"!
In any case you need to count the lines with "***** XYZ BEGIN *****" in it with FILTER like in my first example.
And which of these data do you need to put into the datagrid?
Best
Klaus
so there is no Livecode script involded? The data magically appear in that field? Really?
Simply because you did not provide sufficient info, the log below looks a lot different than the one you posted first!Sorry, It seem is not what i need... maybe a litle bit miss understand....
put fld "whatever" into tData
filter tData with "***** PASING BEGIN *****"
answer" User received message" &&the num of lines of tData && "times."
...
What exactly do you need to count?
We now have "MESSAGE", "PASSING", "FOLDER INFORMATION", "RESULTS" and "RACE INFORMATION"!
In any case you need to count the lines with "***** XYZ BEGIN *****" in it with FILTER like in my first example.
And which of these data do you need to put into the datagrid?
Best
Klaus
Re: How pulling data from TCP Connection?
Hi again Kalus ....
Thank you for being patient for me ....
Let say in log incoming data
this is about recording time and laps
Than when this data incoming again at second time (but it does not need to count)
I want replace the old one with new one
and this Data
here i create video that showing the LOG TEXT FIELD
https://www.youtube.com/watch?v=Em520_tO6Y4
Hope it'll explain more ....
Best Regards
Gilar Kadarsah
Thank you for being patient for me ....
Sorry ... it comes from TCP connection, I just not clearly understand where and put the script.so there is no Livecode script involded? The data magically appear in that field? Really?
Sorry... not count, but replace old data with the new oneWhat exactly do you need to count?
Let say in log incoming data
Code: Select all
13A;OKTAVIANO RIZQY;1;33393
Than when this data incoming again at second time (but it does not need to count)
Code: Select all
13A;OKTAVIANO RIZQY;2;54687
this DataWe now have "MESSAGE", "PASSING", "FOLDER INFORMATION", "RESULTS" and "RACE INFORMATION"!
In any case you need to count the lines with "***** XYZ BEGIN *****" in it with FILTER like in my first example.
And which of these data do you need to put into the datagrid?
Code: Select all
13A;OKTAVIANO RIZQY;1;33393
Code: Select all
1A;WAHYU NUGROHO;1;2459;2459;;YMH YAMALUBE NHK IRC DID NISSIN NGK BAHTERA RT;JATENG;
2A;MUHAMMAD SAIRAJI;1;6425;6425;;BOB's R7 RACING SCHOOL;;
4A;M. GILANG AKBAR ROLAND;1;9295;9295;;YMH ADITAMA ANTASARI STICKER RT;KALTIM;
6A;BONE FIZER MIOLO;1;13204;13204;;HENDRIANSYAH RACING SCHOOL;DKI;
8A;NIA RAMADHANI;1;16427;16427;;N'RPM YAMAHA ALFA SCORPII NHK IRC;SUMUT;
7A;ADITYA DWI CAHYADI;1;19954;19954;;D45 RACING ACADEMY;JATIM;
13A;OKTAVIANO RIZQY;1;33393;33393;;REY RACING SCHOOL;DKI;
3A;MUHAMAD ANDRIAS LUKITO;0;2000000000;0;;YMH YAMALUBE ORYZA NISSIN IRC DID KYT;JATENG;
5A;ARYASENA ARJUNA SETYAJI;0;2000000000;0;;REY RACING SCHOOL;JABAR;
9A;SEPTA PUTRA EKA JATI;0;2000000000;0;;REY RACING SCHOOL;;
10A;CANDRA HERMAWAN;0;2000000000;0;;PUJI RAHAYU MELINDO EDOMIX D45 RACING ACADEMY;JATIM;
11A;MUHAMMAD RESKI AWAL;0;2000000000;0;;BOB's R7 RACING SCHOOL;SULSEL;
12A;MUHAMMAD FAIZ ZULFIKAR;0;2000000000;0;;BOB's R7 RACING SCHOOL;KALTIM;
14A;KIKI ARANXA;0;2000000000;0;;BOB's R7 RACING SCHOOL;JATIM;
15A;FAHMI BASAM;0;2000000000;0;;YAMAHA PRS OYEHE NABIRE;SULSEL;
16A;MUHAMAD ILHAM EFENDI;0;2000000000;0;;D45 RACING ACADEMY;JATENG;
17A;MOHD SILMI HELSINKY;0;2000000000;0;;BOB's R7 RACING SCHOOL;ACEH;
18A;ANDI MAHMUD MAPPEGANTI Y;0;2000000000;0;;AKAIJAYA RT;SULTENG;
19A;MUHAMMAD RIDWAN;0;2000000000;0;;REY RACING SCHOOL;JABAR;
20A;M IRGI SEPTDAJI PUTRA;0;2000000000;0;;REY RACING SCHOOL;JABAR;
https://www.youtube.com/watch?v=Em520_tO6Y4
Hope it'll explain more ....
Best Regards
Gilar Kadarsah
Gilar | from INDONESIA
Re: HOw pulling data from TCP Connection?
Hi Gilar,
Does an external application (NOT Livecode) fill the "LOG" field in your Livecode application?
If yes, how?
I have no idea what, when and where to replace.
I think the first questions above are the most important ones!
Best
Klaus
please answer my questions, or I cannot help you!Sorry ... it comes from TCP connection,...so there is no Livecode script involded? The data magically appear in that field? Really?
Does an external application (NOT Livecode) fill the "LOG" field in your Livecode application?
If yes, how?
Are you sure, in every posting you seem to tell me something different?Sorry... not count, but replace old data with the new oneWhat exactly do you need to count?
I have no idea what, when and where to replace.
I think the first questions above are the most important ones!
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: HOw pulling data from TCP Connection?
Welcome Gilar,
You said you were able to get the data into a LC field. How did you do that? Did you write a script in the LC stack? How did you connect the Elite software to the stack?
The video looks like you are just copying and pasting text manually. Is that true? If so then the solution is different from automatic entries. But first we need to know how the data gets from the framework to the stack.
You said you were able to get the data into a LC field. How did you do that? Did you write a script in the LC stack? How did you connect the Elite software to the stack?
The video looks like you are just copying and pasting text manually. Is that true? If so then the solution is different from automatic entries. But first we need to know how the data gets from the framework to the stack.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to pulling data from TCP Connection?
Hi Klaus
Live Code application connect to esternal application with TCP connection
Then external application passing data into the "LOG"
here is the TCP code
I want to Grab and put it into Data Grid
1A = Motor Number
WAHYU NUGROHO = Racer Name
1 = Number of Laps
2459 = Time
There are about 20-30 racer ....
every time racer passes the start line ( let say this race has 20 laps)
external application will passing data into the "LOG" field in livecode application
So what livecode must do when external application passing data into the "LOG" is ....
1. On first lap
- Grab and put every racer Data into DataGrid / Table
There are 20-30 racer, so it'll be about 20-30 line in DataGrid
2. On 2nd, 3rd, 4th ..... 20th lap
- Update time record and laps number for every racer
Best Regards
Gilar Kadarsah
Yes an external aplication fill the "LOG" field on my Livecode applicaion.please answer my questions, or I cannot help you!
Does an external application (NOT Livecode) fill the "LOG" field in your Livecode application?
If yes, how?
Live Code application connect to esternal application with TCP connection
Then external application passing data into the "LOG"
here is the TCP code
Code: Select all
on openStack
end openStack
command connectIt
if field IP is among the lines of the opensockets then
close socket field IP
set the label of button "Connect" to "Connect"
set the backgroundcolor of button "Connect" to red
else
open socket to field IP
set the label of button "Connect" to "Disconnect"
set the backgroundcolor of button "Connect" to green
if the Result <> "" then
put "result:" && the result
else
readLoop
end if
end if
end connectIt
command readLoop
if field IP is among the lines of the opensockets then
read from socket field IP until empty
put it after field "logField"
---
write "$3" & format("\r\n") to socket field IP of card setting_crd
----
send "readLoop" to me in 50 milliseconds
end if
end readLoop
Yup, sorry ... i can explain good enaugh in English.Are you sure, in every posting you seem to tell me something different?
every time external application passing this data:I have no idea what, when and where to replace.
Code: Select all
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
1A;WAHYU NUGROHO;1;2459
*** PASSINGS END ***
Notes: This is Racer Data Time Record1A;WAHYU NUGROHO;1;2459
1A = Motor Number
WAHYU NUGROHO = Racer Name
1 = Number of Laps
2459 = Time
There are about 20-30 racer ....
every time racer passes the start line ( let say this race has 20 laps)
external application will passing data into the "LOG" field in livecode application
So what livecode must do when external application passing data into the "LOG" is ....
1. On first lap
- Grab and put every racer Data into DataGrid / Table
There are 20-30 racer, so it'll be about 20-30 line in DataGrid
2. On 2nd, 3rd, 4th ..... 20th lap
- Update time record and laps number for every racer
Best Regards
Gilar Kadarsah
Gilar | from INDONESIA
Re: HOw pulling data from TCP Connection?
Hi Gilar,
AHA, we are getting nearer!
OK, so your Livecode application receives the data and of course processes it!
Thank you for this info, although it was really hard to get it.
Okie Dokie, we need to "hook" into your "readLoop" handler right before putting IT into your log field.
Out of my head, so please check for typos, but in general that should work for you.
If you have problems with the rest, please ask!
P.S.
The missing infos did not have to do anything with your english!
Best
Klaus
AHA, we are getting nearer!
OK, so your Livecode application receives the data and of course processes it!
Thank you for this info, although it was really hard to get it.
Okie Dokie, we need to "hook" into your "readLoop" handler right before putting IT into your log field.
Code: Select all
command readLoop
## Get used to put QUOTES around object names, if you don't, this may BITE you some day!
if field "IP" is among the lines of the opensockets then
read from socket field "IP" until empty
## I put the data into a variable, since IT will change
put it into tData
## Now process the data and put it into (or AFTER) the datagrid, see handler below:
put_into_datagrid tData
put tData after field "logField"
...
Code: Select all
command put_into_datagrid tData
## First check if we have a PASSING BEGIN data
## get rid of possible empty lines:
filter tData without empty
## Now check for PASSING:
if NOT (line 1 of tData begins with "*** PASSINGS BEGIN ***") then
exit put_into_datagrid
end if
## Now ignore line 1 and 2 and the LAST line
put line 3 to -2 of tData into tData2
## Make data Datagrid ready:
replace ";" with TAB in tData2
put the dgtext of grp "your dg here..." into tDGT
if tDGT = EMTPY then
## DG emtpy, put into DG:
put tData2 into tDGT
else
## Append data:
put CR & tData2 after tDGT
end if
set the dgtext of grp "your dg here..." to tDGT
end put_into_datagrid
If you have problems with the rest, please ask!
P.S.
The missing infos did not have to do anything with your english!
Best
Klaus
Re: HOw pulling data from TCP Connection?
Hi Klaus .....
Your code works like a charm ...
Thank You very much ....
but it still have a problem for me ...
On update for 2nd, 3rd, 4th etc. Laps
It mean on 2nd, 3rd, 4nd passing ....
In DataGrid there is double name or more
https://drive.google.com/open?id=13u9eq ... 4pjA04nsUo
what i want is only update number of laps and time record
And also there is an empty space on table
Is that any way to fix it?
Best Regards
Gilar Kadarsah
Your code works like a charm ...
Thank You very much ....
but it still have a problem for me ...
On update for 2nd, 3rd, 4th etc. Laps
It mean on 2nd, 3rd, 4nd passing ....
In DataGrid there is double name or more
https://drive.google.com/open?id=13u9eq ... 4pjA04nsUo
what i want is only update number of laps and time record
And also there is an empty space on table
Is that any way to fix it?
Best Regards
Gilar Kadarsah
Gilar | from INDONESIA
Re: How pulling data from TCP Connection?
Hi Gilar,
I ususally do this kind of work, and what you ask for is a bit more complex than my other script, for a living, means for money!
Hints:
Extract the NAME from tData and look for this name in the data of the datagrid -> tDGT
Maybe with lineoffset, then do your thing with the found line if any, means update the ITEMS of that line with the new number of laps etc. before writing the data back into the datagrid.
All this should happen in my "put_into-datagrid" handler, of course!
Because my script explicitely filters out empty lines.
Maybe there is a CRLF instead of a simple CR, which may result in empty lines.
Add this to my handler to be sure:
Best
Klaus
hm, I really like to help, but don't you think that this is going a bit too far for a "little help in the forum"?gilar wrote: ↑Tue Sep 04, 2018 8:45 pm...
On update for 2nd, 3rd, 4th etc. Laps
It mean on 2nd, 3rd, 4nd passing ....
In DataGrid there is double name or more
https://drive.google.com/open?id=13u9eq ... 4pjA04nsUo
what i want is only update number of laps and time record
I ususally do this kind of work, and what you ask for is a bit more complex than my other script, for a living, means for money!
Hints:
Extract the NAME from tData and look for this name in the data of the datagrid -> tDGT
Maybe with lineoffset, then do your thing with the found line if any, means update the ITEMS of that line with the new number of laps etc. before writing the data back into the datagrid.
All this should happen in my "put_into-datagrid" handler, of course!
Are you sure that there is no SPACE or any invisible character in the data?
Because my script explicitely filters out empty lines.
Maybe there is a CRLF instead of a simple CR, which may result in empty lines.
Add this to my handler to be sure:
Code: Select all
command put_into_datagrid tData
replace CRLF with CR in tData
## First check if we have a PASSING BEGIN data
## get rid of possible empty lines:
filter tData without empty
...
Klaus
Re: HOw pulling data from TCP Connection?
Gilar,
You might want to use an array variable in memory to store the most recent data for each racer.
For example when this is received:
So, parse this way:
Then later when this comes in:
There will still only be one entry for 13A but TotalNbTour and TotalTpsCumule will be updated with the new data.
Since this variable is in memory and not in a datagrid of field it will update more quickly.
You can then transfer the data to a field or datagrid.
You also have the advantage of quickly getting any particular bit of information about a racer:
would return
Say you received this:
will give you an array of the current passings for every racer.
Hope this helps.
And welcome to the forum!
Jim Lambert
You might want to use an array variable in memory to store the most recent data for each racer.
For example when this is received:
The array could be structured with the value of Numero as the main Key.*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
13A;OKTAVIANO RIZQY;1;33393
*** PASSINGS END ***
So, parse this way:
Code: Select all
put "OKTAVIANO RIZQY" into raceArray["13A"]["Nom"]
put "1" into gRaceArray["13A"]["TotalNbTour"]
put "33393" into gRaceArray["13A"]["TotalTpsCumule"]
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
13A;OKTAVIANO RIZQY;2;54687
*** PASSINGS END ***
Code: Select all
put "OKTAVIANO RIZQY" into raceArray["13A"]["Nom"]
put "2" into gRaceArray["13A"]["TotalNbTour"]
put "54687" into gRaceArray["13A"]["TotalTpsCumule"]
Since this variable is in memory and not in a datagrid of field it will update more quickly.
You can then transfer the data to a field or datagrid.
You also have the advantage of quickly getting any particular bit of information about a racer:
Code: Select all
put gRaceArray["13A"]["TotalTpsCumule"]
Code: Select all
54687
*** PASSINGS BEGIN *** (1)
Numero;Nom;TotalNbTour;TotalTpsCumule
2A;GILAR KADARSAH;1;50.256
7B;FAJAR RIFAI;2;51.123
13A;OKTAVIANO RIZQY;3;54687
*** PASSINGS END ***
Code: Select all
global gRaceArray
on parsePassings receivedText
set the itemdelimiter to ";"
put line 2 of receivedText into pAttributes
delete line 1 to 2 of receivedText
delete line -1 of receivedText
repeat for each line cRacer in receivedText
repeat with x = 2 to the number of items of pAttributes
put item x of cRacer into gRaceArray[item 1 of cRacer][item x of pAttributes]
end repeat
end repeat
end parsePassings
Hope this helps.
And welcome to the forum!
Jim Lambert