Simplicty and flexibility!


Extract values from a Memo Field (all occurrence)


Started by Marco Marchesi
Search
You will need to Sign In to be able to add or comment on the forum!

Extract values from a Memo Field (all occurrence)

Hi DataEase,

I need to extract the values from a memo field:

any XXXXXXXX YYYYYY

For each occurrence I need to extract the 2 words following the word "any"

How can I do?

Example :

for MimoEspoTiri ;

message current item number .

enter a record in TaaaEspoTiri

copy all from MimoEspoTiri ;

CoasQuota := if(MimoEspoTiri Coas = 0 , 100 , MimoEspoTiri CoasQuota ) ;

Anno := global AnnoElab ;

ClasseIsvap:=any TaanTipiRisCau Classe Isvap ;

DataCess:=any TaaaTDPS Cessazione ;

TipoCess:=any TaaaTDPS TipoCess ;

PercForma1:=any TaaaTDPS Forma1% ;

DurataPol:=any TaaaTDPS DurataPol ;

PercForma2:=any TaaaTDPS Forma2% ;

TipoAppendice:=any TaaaTDPS TipoAppendice ;

TipoApp2:=any TaaaTDPS TipoApp2 ;

SymphonyId:=any TaalAnagrafiche SymphonyId ;

BRSF_Rating:=any TaalAnagrafiche BRSF_Rating ;

CCIAA:=any TaalAnagrafiche CCIAA ;

Nace:=any TaalAnagrafiche Ateco2 .

end .

Thanks


Written by Marco Marchesi 20/03/18 at 10:22:53 Dataease [{8}]FIVE

Re:Extract values from a Memo Field (all occurrence)

Download Sample

We are currently working with the handicap that we are developing (and using) the next version of DataEase  (DE9) while we support in the last.

This would be quite straight forward in the next but not so in 8.5. 

Still it is absolutely possible.

In Short what you have to do is to spilt the DQL into its lines which you simply do by exporting it and importing it back into a table with record separator carriage return.

You now have the DQL in single lines that can be manipulated with string functions (in DE9 you will be able to manipulate memos directly up to 4GB).

When you have to the DQL back into single lines you can simply run a DQL like this.

define "retval" text 255 .

for MyDQLLines ;

retval := firstw(stringbetween(DQL,"any",lastc(DQL,1)),2) .

if retval not=blank then

list records

retval .

end

What we do is simply cut out what is between any and the end of the line and then cut out the two first words.


Written by DataEase 20/03/18 at 12:02:15 Dataease [{8}]FIVE

Re:Re:Extract values from a Memo Field (all occurrence)

Great! (thanks also for the sample attached). It's a very good solution for a single DQL. But if I have to repeat the same operation for all the DQL present in the file. How can I do ? I already tried to run the procedure for every DQL saving the DQLName for each line but it's become a very long procedure becuase I have to perform an export/import for each DQL present. Have you an alternative and performing solution? (v. 8.5)   Thanks.


Written by Marco Marchesi 22/03/18 at 13:47:22 Dataease [{8}]FIVE
DG3_ForumList