Hi,
I have a file A (.csv) which has let's say 100 rows. I need to read this as a source and create two output files B & C based on the data inside. For explanation purpose the files has 10 columns. I need to trasfer data from A to B & C both until column 1 hits word "CRAP", then I need to transer data between CRAP and "CRAP1" to file B and data between "CRAP2" and "CRAP3" to file C. Also transer remaining data from File A to both B & C. Any easy way to do then writing custom routine ?
Any help appreciated.
Thanks
VSanghvi
Sequential file parsing.
Moderators: chulett, rschirm, roy
Just a few stage variables and a couple of constraints in the transformer will do the trick. Once your condition is met, the stage variable should update to reflect that the condition is met. Use that stage variable as a constraint on the other output links.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Hi kcbland
I tried defining stage variables like (If FoundRow OR (DSLink3.Field001 Matches 'CRAP') Then 1 Else 0)
but it is not helping much. Can you give me example of stage variable condition based on my requirements I can try ? I appreciate your help
I tried defining stage variables like (If FoundRow OR (DSLink3.Field001 Matches 'CRAP') Then 1 Else 0)
but it is not helping much. Can you give me example of stage variable condition based on my requirements I can try ? I appreciate your help
kcbland wrote:Just a few stage variables and a couple of constraints in the transformer will do the trick. Once your condition is met, the stage variable should update to reflect that the condition is met. Use that stage variable as a constraint on the other output links.
If you have a transform with OutB and OutC
StageVar - FoundCrap, 'IF In.Col1='CRAP' OR FoundCrap THEN 1 ELSE 0
StageVar - FoundCrap1, 'IF In.Col1='CRAP1' OR FoundCrap1 THEN 1 ELSE 0
StageVar - FoundCrap2, 'IF In.Col1='CRAP'2 OR FoundCrap2 THEN 1 ELSE 0
constraint for OutA : NOT(FoundCrap) OR (FoundCrap1)
constraint for OutB : NOT(FoundCrap) OR (FoundCrap2)
StageVar - FoundCrap, 'IF In.Col1='CRAP' OR FoundCrap THEN 1 ELSE 0
StageVar - FoundCrap1, 'IF In.Col1='CRAP1' OR FoundCrap1 THEN 1 ELSE 0
StageVar - FoundCrap2, 'IF In.Col1='CRAP'2 OR FoundCrap2 THEN 1 ELSE 0
constraint for OutA : NOT(FoundCrap) OR (FoundCrap1)
constraint for OutB : NOT(FoundCrap) OR (FoundCrap2)
Hi Arndw,
Thanks for your help. It works partially. When I set variable using your suggestion it does transfer data between two files but it stopes after it finds once the CRAP and CRAP1. I need to reset the variable again and again as the file might have 'CRAP' and 'CRAP1' again and again and I need to transger all similar finding in to two different files B & C. In other words whenever I find CRAP and CRAP1 then I need to put that in file B and whenever I find CRAP2 and CRAP 1 again I need to put that in file C. Any thoughts how can I get this working ?
Thanks
VSanghvi
Thanks for your help. It works partially. When I set variable using your suggestion it does transfer data between two files but it stopes after it finds once the CRAP and CRAP1. I need to reset the variable again and again as the file might have 'CRAP' and 'CRAP1' again and again and I need to transger all similar finding in to two different files B & C. In other words whenever I find CRAP and CRAP1 then I need to put that in file B and whenever I find CRAP2 and CRAP 1 again I need to put that in file C. Any thoughts how can I get this working ?
Thanks
VSanghvi
ArndW wrote:If you have a transform with OutB and OutC
StageVar - FoundCrap, 'IF In.Col1='CRAP' OR FoundCrap THEN 1 ELSE 0
StageVar - FoundCrap1, 'IF In.Col1='CRAP1' OR FoundCrap1 THEN 1 ELSE 0
StageVar - FoundCrap2, 'IF In.Col1='CRAP'2 OR FoundCrap2 THEN 1 ELSE 0
constraint for OutA : NOT(FoundCrap) OR (FoundCrap1)
constraint for OutB : NOT(FoundCrap) OR (FoundCrap2)
vsanghvi,
I intentionally don't complete code snippets - that way you need to look at it and understand what it does {so that you can complete it}. The code given will do what your initial query asked. Now your requirements are to
I intentionally don't complete code snippets - that way you need to look at it and understand what it does {so that you can complete it}. The code given will do what your initial query asked. Now your requirements are to
So, the 2 stage variables use an OR to ensure that once they get set to 'true' or '1' they remain so. If you need to do this row by row you need to make sure that these stage variables do not retain their last value, so remove the OR....I need to reset the variable again and again as the file might have 'CRAP' and 'CRAP1' again and again...