I am practicing creating an automation to properly scrape a number of items off of a real estate listings website.
I am scraping the square footage of each of the properties and often times a handful of them contain no data and are logged as so in the Immediate table as: []
The output provides this: Assign: String cannot be of zero length
I’ve tried a number of ways to fix this to a 0 so I can pull out 0 values later from my scrape… but no luck.
I created a new variable Sqft set as a double.
The original assign I use under this if that detects whether the value is Null or Empty is the following Assign:
Also, the Int32.TryParse(stringNumber, out output_Int32) is another option you can try.
Example:
stringNumber As String
stringNumber=String.Empty
output_Int32 as Int32
if Int32.TryParse(stringNumber, out output_Int32) Then
WriteLine "Success! Integer value of String is " + output_Int32.ToString()
Else
WriteLine "Blast! Failed to convert " + stringNumber + " to number!"
End If
You could use this in the Assign Activity
Boolean did_it_work = Int32.TryParse(stringNumber, out output_Int32)