Prepare For Output: Strip comma values from numbers
Hello Support:
I'm trying to remove the comma from my saved values in order to prepare it for cvs output. I've been using the following code from previous scrapings with no problem:
i = 0;
// Iterate through each variable in the array above
while (i < variables.length){
//Get the variables to be fixed
value = session.getVariable(variables[i]);
//Log the UNFIXED values
session.log("UNFIXED: " + variables[i] + " = " + value);
if(value != null){
//Remove non-numerical elements
value = value.replaceAll(",", "");
// Set variables with new values
dataRecord.put(variables[i], value);
session.setVariable(variables[i], value);
//Log the FIXED values
session.log("FIXED " + variables[i] + " = " + session.getVariable(variables[i]));
}
i++;
}
But now I'm receiving the following error message in the log:
Writing data to a file.
UNFIXED: LAST_MARKET_SALE_SALE_PRICE = $132,000
An error occurred while processing the script: 09 Write Los Angeles Multi-Family
The error message was: class bsh.EvalError (line 7): try { -- Attempt to invoke method: put() on undefined variable or class name: dataRecord
08 Realist Property Details for LAMF: Applying extractor pattern: HAS_NEXT_PAGE
08 Realist Property Details for LAMF: Extracting data for pattern "HAS_NEXT_PAGE"
Line 7 of "09 Write Los Angeles Multi-Family" is the "try" portion of the code:
{
I hope I have included enough information for you to review. I have tried for countless hours trying to figure out why it's not working. Thanks in advance for your help.
I finally figured it out...
No need to reply to this post because I finally figured it out. :D
Script wasn't running on each
Script wasn't running on each pattern application, right? I do that sometimes too.
You are...
Correct!!!