Hi Roopa,
- You can use get meta data activity to get list of files.
- use foreach loop to go over the files
- use a lookup activity on the file to get file content
- use an if condition and decide whether the value of TotalNbrOfEntries is greater than 0 or not
- if TotalNbrOfEntries>0, in true condition, have your data flow. leave the false part empty
- use an if condition and decide whether the value of TotalNbrOfEntries is greater than 0 or not
- use a lookup activity on the file to get file content
I Tried with similar setup.
My file:
<?xml version="1.0"?>
<books TotalNumberofEntries="2">
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
</book>
</books>
So, under books, i had TotalNumberofEntries attribute. Based on this, i will decide if to process the file or not.
My pipeline design (u can replace set variable with if activity)
Get meta data: gets all file \folders
Filter : filters just xml files
foreach: loops over files to process
lookup: looks up file content
Set variable: captures the value of the attribute as follows
@activity('Lookup1').output.value[0]['books']['@TotalNumberofEntries']
If you are using if condition, this expression would be like below
@greater(activity('Lookup1').output.value[0]['books']['@TotalNumberofEntries'],0)
Hope it helps. Please let us know if you have questions.
Thanks