This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Another way to accomplish this is to use a Join tool to a second dataset that just has a vertical list of the column names you care about. Then you can run a test to ensure that the number of records is equal to the number of fields in dataset 2, rather than testing each name individually in the Test tool.
For my project, the Input Data file can have any number of fields... and I'm only concerned with 5 or 6 of them... so your solution wouldn't work in this instance. But for future, I can see how this would be far more efficient than checking each field name!
I think what I proposed will work for any number of fields on either side. I've attached a quick example here.
The Required Fields and Compared Data example is the one that should pass. I also included a case that will fail so that you can see how it works. Feel free to play around with this and see if it meets your need.
What I meant was the Input Date file for this app might have 6 fields, or it might have 20, depending on how the specific user chose to export it and/or clean it. The app needs to accept both types of files (and more)... but as long as it has 4 or 5 particular fields, that's all I care about for this particular processing. So having a fixed list of fields wouldn't work (since it varies)
But I realize this is pretty unusual, and best practice would be for all Input Data to have the same structure... we're just not there yet.
Also, I could see a lot of rogue data files having x number of fields but having nothing to do with the processing I'm trying to accomplish. So if I were checking that the file has x number of fields, but I don't validate that they're the exact x fields I need, the processing would fail.
I think I'm understanding your use case, and I would definitely recommend taking a look at the attached.
What this will do is use an input with the 5 or 6 fields you actually care about, join against that (so that we are only looking for those fields), and then check that there are an equal number of fields that we Found, and that we were Searching for. It won't look at any field you don't specify in the second input, and the file the user inputs could have thousands of other fields without issue.