Discussion:
How to have an optional CSV feed?
(too old to reply)
g***@panix.com
2017-02-28 17:57:20 UTC
Permalink
Raw Message
I'm working on an AL with several iterator connectors in the Feed section, one of which is a CSV file iterator. The file itself may or may not be present.

If the file is not present, the AL aborts with a NextIteratorEntry exception. How can I make the AL instead just move on to the next feed connector?

Thanks,

John Gordon
***@panix.com
yn2000
2017-03-01 15:21:17 UTC
Permalink
Raw Message
I am not sure I understand the question: "How can I make the AL..." But, for code versioning and future code maintenance reasons, I always try to avoid multiple connectors in iterator mode. I'd like to spread around to multiple AL(s) and use a main AL to control which AL to call and when. Imagine, if you put everything in one AL and you need to update one attribute in one connector, then you are obliged to do a regression testing of all functionality in that AL. Another example, in your case, if you spread into various AL then you might have found your way out immediately.

But, that is just my programming style. I did not understand your situation and may not answer your question, but hopefully it helps you thinking about a way out.

Rgds. YN.
Eddie Hartman
2017-03-01 19:17:15 UTC
Permalink
Raw Message
Post by yn2000
I am not sure I understand the question: "How can I make the AL..." But, for code versioning and future code maintenance reasons, I always try to avoid multiple connectors in iterator mode. I'd like to spread around to multiple AL(s) and use a main AL to control which AL to call and when. Imagine, if you put everything in one AL and you need to update one attribute in one connector, then you are obliged to do a regression testing of all functionality in that AL. Another example, in your case, if you spread into various AL then you might have found your way out immediately.
But, that is just my programming style. I did not understand your situation and may not answer your question, but hopefully it helps you thinking about a way out.
Rgds. YN.
Why not look to see if the file exists in the Before Execute Hook of the CSV Iterator?

filepath = thisConnector.connector.getParam("filePath");
file = new java.io.File(filepath);
if (!file.exists()) {
system.ignoreEntry(); // got to next Iterator
}
g***@panix.com
2017-03-02 04:28:51 UTC
Permalink
Raw Message
Post by Eddie Hartman
Why not look to see if the file exists in the Before Execute Hook of the CSV Iterator?
filepath = thisConnector.connector.getParam("filePath");
file = new java.io.File(filepath);
if (!file.exists()) {
system.ignoreEntry(); // got to next Iterator
}
Looks good! I always learn something from your responses Eddie.

But I have to admit I was expecting the answer to be something in an error hook, or in the connection tab.

Thanks again.

John Gordon
***@panix.com
Eddie Hartman
2017-03-02 20:59:53 UTC
Permalink
Raw Message
Post by g***@panix.com
Post by Eddie Hartman
Why not look to see if the file exists in the Before Execute Hook of the CSV Iterator?
filepath = thisConnector.connector.getParam("filePath");
file = new java.io.File(filepath);
if (!file.exists()) {
system.ignoreEntry(); // got to next Iterator
}
Looks good! I always learn something from your responses Eddie.
But I have to admit I was expecting the answer to be something in an error hook, or in the connection tab.
Thanks again.
John Gordon
You're so right that there are lots of ways to skin this feline, John, including via error hooks and restarting the current cycle. Using the Before Execute Hook is the simplest approach.
Loading...