Help with dataSet.deleteDataRecordin JAVA
I am needing some help with some syntax in JAVA. I am getting some stuff in my dataset that I don't want. It makes my import break when the text file goes into my database. I want to be able search for string of text in my dataset and if that string is present I will delete the that dataset before I write out my CSV file
IF
string in dataset= "stringidonotwant"
THEN
getdatarecordnumber
dataSet.deleteDataRecord( dataRecordNumber );
END IF
Can anyone help?
That worked! Thank you so
That worked! Thank you so much!
Well, There isn't a good way
Well, There isn't a good way to remove data from a "dataSet" object, but on the other hand... you could easily delete the data if you got to it when it's still a "dataRecord". In other words, remove it "after each pattern application" instead of after the whole scrapeableFile or scrapingSession is done.
I haven't had to do this before, but you could try making a script that runs "After each pattern application", and make it do something like the following:
String[] unwanted = {
"some string",
"another string"
};
for (int i = 0; i < unwanted.length; i++)
{
if (dataRecord.get(unwanted[i]) != null)
{
dataRecord.put(unwanted[i], null);
}
}
This way, any time you pick up variables that you don't want to write (like junk variables that aren't needed), they will be removed.
In the end, your dataSet shouldn't have those variables, because you're removing them from the source.