Quantcast
Channel: SCN : Unanswered Discussions - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 3719

Case statement - how to only send to target datastore if valid records?

$
0
0

My use case is as follows.

 

I have several files, being placed in a directory, with a naming convention similar to MYNAME.*.txt where * is A, B, etc.

 

I want to have a single job to execute on all files matching MYNAME.*.txt and then send the data to A.txt, B.txt, etc. If a file is MYNAME.A.txt I only want to update A.txt.

 

I currently have implemented a basic workflow reading the files and then using a case statement to send, based on filename, to whichever output filename is appropriate.

 

However, this means that if there is only one file to load (MYNAME.A.txt) an empty txt is created for all conditions of the case statement (B.txt will be blank).

 

Is there a way to only execute a case statement if there is data or if it matches a filename?

 

In pseudo code, I want something like:

 

Case (letter){

 

Case A: generate a.txt

 

Case B: generate b.txt

}

 

Rather than basically executing all cases, but only sending filtered data to each.


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>