Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

searching the keyword for different files

Ekta
8 - Asteroid

Dear All,

i am struggling with this situation, any help will be appreciated please-

i would like to run my workflow for multiple files (one file in each run). 

 

 Its an excel with multiple fields and i would like to search  keyword "in the class"  in all the fields, if we find this keyword in any of the field then it should return "in class"  but if it does not find it then it should return "not in class".

 and this processing is suppose to be done for individual files  for example-

 

file 1 - field1 field2             field3    field4                     output -  field1 field2             field3    field4          Field 5          

               w       in the class    23        xy                                          w       in the class    23        xy             in class

 

file 2 - field1    field2         field3    field4                     output -  field1 field2    field3    field4          Field 5          

               w       qwert            23        xy                                          w   qwert    23        xy           not  in class

 

Thanks in advance

             

3 REPLIES 3
AngelosPachis
16 - Nebula

Hi @Ekta ,

 

Do all your files have the same number of fields, same field names and do all those fields come in the same consistent sequence?

Ekta
8 - Asteroid

Thanks a lot for reply, they may be same or different but mostly same.

 

Thank you so much

AngelosPachis
16 - Nebula

Considering that the fields contained in the different files might be different, you have to take a batch macro approach.

 

A batch macro will allow you to run a particular workflow for each one of your input files. What you have to do is first of all use a directory tool to get the Full path for each one of your files. Those files should be in the same folder, and the only thing you have to do is point that directory tool to that folder.

 

The directory tool will return you some fields for each one of your files; in this example I've mocked up 3 files, with the input you have provided. The field you are looking to use is the first one  which is named Full Path. 

AngelosPachis_0-1610136213333.png

 

This is what you should feed in the batch macro I've created for you.

AngelosPachis_1-1610136236087.png

 

Now let's see what happens inside that batch macro.

Screenshot 2021-01-08 200642.jpg

First you have an Input Data tool and some tools above it; those tools are those that will go on and dynamically change the File path every time the batch macro runs. So from the first image I have attached in this post, this macro will run for each of those file path, essentially reading all files one by one.

 

The for each file, you pivot the data to bring it in a long format and check if "in the class" is contained in the values column.

 

 

Screenshot 2021-01-08 201210.jpg

 

Hope that helps, let me know if you have any questions.

 

Regards,

 

Angelos

Labels
Top Solution Authors