SCADA Split Function

4 Posts
3 Users
0 Likes
31 Views
(@s-fauchillearcinfo-com)
Posts: 28
Eminent Member
Topic starter
 

Hello,

Has anyone ever performed a Split function in SCADA Basic?

Thanks

Stéphan

 
Posted : 01/03/2018 1:29 pm
(@s.epaillard@arcinfo.com)
Posts: 0
New Member Guest
 

Comments are useless for a smart boy like you

SUB Str_Extract_Data(Line,Index)
  DIM hdl as long;
  DIM ch as str;
  DIM length as integer;
  hdl = ALLOC_BUFFER(1000);
  PUT_BUFFER(hdl, 0,Line);
  length = ASCIIFIELD("LEN",hdl);
  if(length>0 && ASCIIFIELD("COUNT",hdl,";")>1) then
  	ch = ASCIIFIELD("STR",hdl,Index,";");
  else
  	ch = ASCIIFIELD("STR",hdl,Index,",");
  end if
  free_buffer(hdl);
  return(ch);
END SUB
 
Posted : 01/03/2018 1:34 pm
n.kunzer
(@n-kunzerarcinfo-com)
Posts: 1236
Member Moderator
 

HI Stephan,

I don't really understand your request.
You want to split a string in an Array according a separator?
If yes, you have 2 instructions in scada basic: ASCIIFIELD and SEQ_BUFFER

The difference between these 2 instructions is the performances and features.
Asciifield is usefull for small string like 1 line.
Seq_buffer is performant if you want to extract line from a file (separator is n). Also it is able to insert string...

Nico

 
Posted : 02/03/2018 8:58 am
(@s-fauchillearcinfo-com)
Posts: 28
Eminent Member
Topic starter
 

I'm a little lazy and I wanted to know if someone already had something done.
But I got my answer.
Thank you

 
Posted : 02/03/2018 2:55 pm