Source language: Translate to:

Classify

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Classify

Postby Neobook » Sat Mar 31, 2007 7:32 am

Hello,

I have a very long text file, more than 11000 lignes, and I want to classify my information. All the important information are between
Code: Select all
<ml>
and
Code: Select all
<ml/>


There is <tm> too
Code: Select all
<tm>


For example :
Code: Select all
<ml>Info1<ml/>

Code: Select all
<tm>Info2


The 11000 lignes are only this code. How can I do for classify automatically in a DBF file, Info1 must going in [data.info1] and Info2 must going in [data.info2].


I give you an example :

Code: Select all
</tm>
   </gory>
   <gory>
      <ml>Info1</ml>
      <tm>Info2 <sr/>
</tm>
   </gory>
   <gory>
      <ml>Info3</ml>
      <tm>Info4
</tm>
   </gory>
   <gory>
      <ml>Info5</ml>
      <tm>Info6



But WARNING, if the <ml> and <tm> have to =1, it's mean if there is information in <ml> but not <tm>, the program must not copy the information to the DBF file.

Thank you



[/code]
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Re: Classify

Postby dpayer » Sat Mar 31, 2007 4:24 pm

Are you attempting to put this in standardized XML format? If you are, it will be much easier to import into a variety of tools.

But the format doesn't seem quite right the way you have it. You need to close each element after you start it and this set doesn't appear to do that

<gory>
<ml>Info1</ml>
<tm>Info2 <sr/>
</tm>
</gory>


You appear to be inserting a tag <sr/> without a counterpart.

If you are not using XML, please forgive my instrusion.

David P.
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neobook » Sat Mar 31, 2007 10:37 pm

Hello,

I use the.txt file, so my idee was, FileRead, and search all the info between "<ml>" "</ml>" and "<tm>". But, if one of both does not have information, then it passes to the following.

I can not do that, because I don't not what I have to take for function.


Thanks
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Postby Neobook » Wed Apr 04, 2007 8:03 am

Hello,

I have a idea, this code

Code: Select all
</tm>
   </gory>
   <gory>
      <ml>Info1</ml>
      <tm>Info2 <sr/>
</tm>
   </gory>
   <gory>
      <ml>Info3</ml>
      <tm>Info4
</tm>
   </gory>
   <gory>
      <ml>Info5</ml>
      <tm>Info6


I have to load it in a variable with FileRead to the variable [Text01]. When it had load the code, it searchs all information with "<ml>", it loads the information in the variable [Information01] and delete "<ml>" and "</ml>", so, I have found my information what I want. It is the same program for "<tm>" it found, copy, delete and past.


Thank you
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Postby Neobook » Thu Apr 05, 2007 11:21 pm

Help me please !
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Postby Neosoft Support » Fri Apr 06, 2007 10:38 am

You'll have to loop through the file reading each line one at a time. Use SearchStr to scan the line for your keys (<ml>,<tm>). Then copy the desired portion of the text to your database variables.

It's fairly complicated. Have you considered hiring someone to write this for you? There are several very good NeoBook coders here who might be interested.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Neobook » Thu Apr 12, 2007 5:15 am

Thank you
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

GORY....

Postby virger » Fri Apr 13, 2007 9:42 am

NO ENTIENDO MUY BIEN PERO QUIZA ESTO TE AYUDE:

... TEXTO COMO Gory.Txt EN PUBDIR

</tm>
</gory>
<gory>
<ml>Info1 Ml</ml>
<tm>Info2 Sr<sr/>
</tm>
</gory>
<gory>
<ml></ml>
<tm>Info4 Tm
</tm>
</gory>
<gory>
<ml>Info5 Ml</ml>
<tm>Info6 Tm
</tm>
</gory>
<gory>
<ml></ml>
<tm>Info8 Sr<sr/>
</tm>
</gory>
<gory>
<ml>Info9 Ml</ml>
<tm>Info10 Tm
</tm>
</gory>
<gory>
<ml>Info11 Ml</ml>
<tm>Info12 Tm


AND THIS IN A BUTTON
----------------------
FileLen "[PubDir]Gory.Txt" "[ln]"
loop "1" "[ln]" "[l]"
FileRead "[PubDir]Gory.Txt" "[l]" "[dat]"
if "[dat]" "=" "</tm>"
setvar "[flg_tm]" "T"
math "[l]+3" "" "[l]"
FileRead "[PubDir]Gory.Txt" "[l]" "[dat]"
SearchStr "<ml>" "[dat]" "[ps]"
substr "[dat]" "[ps]+4" "9999" "[dat]"
SearchStr "<" "[dat]" "[ps]"
substr "[dat]" "1" "[ps]-1" "[info]"
if "[info]" "=" ""
math "[l]+1" "" "[l]"
FileRead "[PubDir]Gory.Txt" "[l]" "[dat]"
SearchStr "<tm>" "[dat]" "[ps]"
substr "[dat]" "[ps]+4" "9999" "[dat]"
SearchStr "<" "[dat]" "[ps]"
if "[ps]" ">" "0"
substr "[dat]" "1" "[ps]-1" "[info]"
else
substr "[dat]" "1" "9999" "[info]"
endif
endif
alertbox "Data" "Info: [info]"
endif
endloop


GERARDO FROM COSTA RICA, "PURA VIDA"
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Neobook » Fri Apr 13, 2007 9:44 am

Thank you very much


Very good
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron