script component error
First, I'll try to answer your question - but then I'll comment on some other things you might want to consider. An "out of bounds" error could be several places in your code - using Try/Catch blocks and/or MsgBoxes and/or ComponentMetaData.FireInformation calls will tell you where the problem is for sure. The first place it could be is after your Split call. If there are fewer than two commas in your Column0 - for example, the value is blank - then assigning the paymentDate variable will fail. You should check that keyBankHeaderColumns has a UBound of 2 or more, and decide what to do if it doesn't. Although the rest of your code is commented, it presents the same problem - you're assuming there are always an appropriate number of elements in your array. I don't see intCount causing any problems here. Second - some things you might want to consider: Don't do the lookup (sqlCommand) in this script. Just parse your Column0. Do the lookup using a Lookup component after the Script. It will be more efficient, manageable, and maintainable.You may want to consider doing away with the script entirely, and use the Derived Column component instead. Using FINDSTRING and SUBSTRING you can "tokenize" (split) a string up and make new columns from it. The expressions you'll have to build will be more complicated than a simple .Net split... but adding columns in a script component is very opaque and hard to understand too.You may want to split the difference... Use a Derived Column before your Script to create (blank/null) columns, then use the script component to fill them. That way, you can keep your relatively simple .Net "split" code, but not have to define columns in the script editor. Talk to me now on
February 11th, 2012 2:34pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics