The problem an BATCH

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Xavisbd
Posts: 2
Joined: 26 Nov 2013 06:35

The problem an BATCH

#1 Post by Xavisbd » 26 Nov 2013 06:38

Good Morning,

I have a question how to schedule a BAT, I I have been researching but I am find the solution.

I have a text file into columns, this may have hundreds of rows.

PADRE;HIJO;FORMULA;PAIS
DC_IC;CG_IC;;
F_0356698;F_4567879345;Formula;

The FORMULA can be this.
Formula = /* Inicio Formula Asigna valores a país */ IF(@ISMBR("CBU","DES"))@SUM(@CHILDREN(@CURRMBR("Cl ients")));ENDIF; /* Asigna valores a Iberia */IF(@ISMBR("CBU","Iberia"))@SUM(@CHILDREN(@CURRMBR( "CBU")));ENDIF;;
The final file would be this:
“PADRE“,“HIJO“,“FORMULA“
“DC_IC“,“CG_IC“,“ “
“F_0356698“,“F_4567879345“,“Formula“

as I can get?
I think
I create a counter of semicolon (;)
At the beginning of each row you put the character you put "
If find the first ; then ; = “;”
If find the second ; then ; = “;”
At the end of each row you put the character you put "

Thanks

rodrigolima
Posts: 21
Joined: 19 Jul 2013 11:35
Location: Brazil

Re: The problem an BATCH

#2 Post by rodrigolima » 27 Nov 2013 09:20

Good Afternoon Xavisbd

I created a text file called inputFile.txt.In its content I wrote the text below:

PADRE;HIJO;FORMULA;PAIS
DC_IC;CG_IC;;
F_0356698;F_4567879345;/* Inicio Formula Asigna valores a país */ IF(@ISMBR("CBU","DES"))@SUM(@CHILDREN(@CURRMBR("Cl ients")));ENDIF; /* Asigna valores a Iberia */IF(@ISMBR("CBU","Iberia"))@SUM(@CHILDREN(@CURRMBR( "CBU")));ENDIF;;;

Take a look at the script below:

Code: Select all

@echo off
cls

if exist outputFile.txt del outputFile.txt

for /F "tokens=1,2,3,* delims=;" %%a in (inputFile.txt) do (
   echo "%%a","%%b","%%c","%%d" >> outputFile.txt
)

goto:eof


After run script, the file outputFile.txt is generated.Take a look and see:

"PADRE","HIJO","FORMULA","PAIS"
"DC_IC","CG_IC","",""
"F_0356698","F_4567879345"," /* Inicio Formula Asigna valores a país */ IF(@ISMBR("CBU","DES"))@SUM(@CHILDREN(@CURRMBR("Cl ients")))","ENDIF; /* Asigna valores a Iberia */IF(@ISMBR("CBU","Iberia"))@SUM(@CHILDREN(@CURRMBR( "CBU")));ENDIF;;;"

I hope that it help you Xavisbd.

See you

Xavisbd
Posts: 2
Joined: 26 Nov 2013 06:35

Re: The problem an BATCH

#3 Post by Xavisbd » 03 Dec 2013 08:50

Hello,

the solution that you gave me, it was not correct . but it was of great help. because any changes I wanted to reach

Thanks

Post Reply