Jump to content
Fivewin Brasil

array


syspel

Recommended Posts

 

bom dia 

preciso salvar este este array dentro de arquivo txt

como eu faço isto

obrigado

carlos

fwh1805  dbf  clip53 bcc730

 

clear
set talk off
set date brit

mdata=ctod("30/01/2019")

pcnpj="72898646000149"

envio  ="..\esocialsyspel\"+pcnpj+"\envio\"
enviado="..\esocialsyspel\"+pcnpj+"\enviado\"

select 1
use etmp
go top

aesocial:={}

Do While ! Eof()

  select 1

   AADD(aesocial,{rtrim(etmp->linha)})

   select 1
   skip

Enddo

use

info=" "

For V1:=1 To Len(aesocial)

      if aesocial[v1,1]="</evento>"

         memowrit("S2200.xml",info)

     endif
next


 

Link to comment
Share on other sites

Ailton é muinto simples, basta fazer esta alteração:

info:=" "

For V1:=1 To Len(aesocial)

     info+=aesocial[v1,1] // Monta a string  com o conteudo do xml aqui 

      if aesocial[v1,1]="</evento>"

           memowrit("S2200.xml",info)  //  Grava o xml 

    else 

          info+=chr(13)+chr(10) // Quebra de linha

     endif
next

 

Link to comment
Share on other sites

local info:="" // Declara a variavel como locano no inicio do aerquivo

mdata    :=ctod("30/01/2019")
pcnpj    :="72898646000149"
envio    :="..\esocialsyspel\"+pcnpj+"\envio\"
enviado  :="..\esocialsyspel\"+pcnpj+"\enviado\"

select 1
use etmp
dbgotop()

Do While etmp->( !eof()
   do case
      case rtrim(etmp->linha) = "<evento>" 
         info:=""  // Reinicia a variavel para um novo arquivo 
      case rtrim(etmp->linha) = "</evento>" // final do arquivo
         //aqui voce tem opção de gravar o xml incluindo o id no nome do arquivo
         //desta forma gernado um xml para cada ide ou funcionario diferente
         //ex: memowrit(cId+"S2200.xml",info)
         memowrit("S2200.xml",info)  //  Grava o xml
      otherwise
         // Monta a string pra gravar no xml
         info+=rtrim(etmp->linha)+chr(13)+chr(10)
   endcase
   etmp->( dbskip())
Enddo
// Fecha o arquivo temporario aqui
etmp->( DbCloseArea() )

 

Link to comment
Share on other sites

JmSilva, explique melhor porfa.

#include 'fivewin.ch'
	Function Main()
	   Local aData1, aData2, cBinData
 
   aData1 := { "Tom", "Dickenson", "Harry" }
	   cBinData := ASave( aData1 )  // Converts Array Data and to Binary and stores in cStr
 
   aData2 := ARead( cBinData )  // Reads data from Binary and then converts back to Array
	   MsgList( aData2 )
 
Return nil


 

Link to comment
Share on other sites

 

JmSilva, explique melhor porfa.

 


#include 'fivewin.ch'
	Function Main()
	   Local aData1, aData2, cBinData
 
   aData1 := { "Tom", "Dickenson", "Harry" }
	   cBinData := ASave( aData1 )  // Converts Array Data and to Binary and stores in cStr
 
   aData2 := ARead( cBinData )  // Reads data from Binary and then converts back to Array
	   MsgList( aData2 )
 
Return nil

Salvar
MemoWrit("file.txt",ASave(aData1))

Recuperar

aData2 := ARead(MemoRead("file.txt"))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...