How To Pull Information From XML File
I have created a link in calculation = http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=X1-ZWz1a84vilprm3_82rpe&address=19524+San+Chisolm+Drive&citystatezip=RoundRock%2c+TX
based on specific fields in Podio. If you click on the link it returns an XML file that has
<SearchResults:searchresults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SearchResults="http://www.zillow.com/static/xsd/SearchResults.xsd" xsi:schemaLocation="http://www.zillow.com/static/xsd/SearchResults.xsd http://www.zillowstatic.com/vstatic/7b712f4/static/xsd/SearchResults.xsd">
<request>
<address>19524 San Chisolm Drive</address>
<citystatezip>RoundRock, TX</citystatezip>
</request>
<message>
<text>Request successfully processed</text>
<code>0</code>
</message>
<response>
<results>
<result>
<zpid>70334586</zpid>
<links>
<homedetails>
http://www.zillow.com/homedetails/19524-San-Chisolm-Dr-Round-Rock-TX-78664/70334586_zpid/
</homedetails>
<graphsanddata>
http://www.zillow.com/homedetails/19524-San-Chisolm-Dr-Round-Rock-TX-78664/70334586_zpid/#charts-and-data
</graphsanddata>
<mapthishome>http://www.zillow.com/homes/70334586_zpid/</mapthishome>
<comparables>http://www.zillow.com/homes/comps/70334586_zpid/</comparables>
</links>
<address>
<street>19524 San Chisolm Dr</street>
<zipcode>78664</zipcode>
<city>Round Rock</city>
<state>TX</state>
<latitude>30.489838</latitude>
<longitude>-97.605559</longitude>
</address>
<FIPScounty>48453</FIPScounty>
<useCode>SingleFamily</useCode>
<taxAssessmentYear>2014</taxAssessmentYear>
<taxAssessment>271781.0</taxAssessment>
<yearBuilt>2007</yearBuilt>
<lotSizeSqFt>10498</lotSizeSqFt>
<finishedSqFt>5383</finishedSqFt>
<bathrooms>4.0</bathrooms>
<lastSoldDate>06/18/2007</lastSoldDate>
<zestimate>
<amount currency="USD">357121</amount>
<last-updated>05/19/2015</last-updated>
<oneWeekChange deprecated="true"/>
<valueChange duration="30" currency="USD">13392</valueChange>
<valuationRange>
<low currency="USD">310695</low>
<high currency="USD">396404</high>
</valuationRange>
<percentile>0</percentile>
</zestimate>
<localRealEstate>
<region name="Pflugerville" id="47080" type="city">
<zindexValue>168,600</zindexValue>
<links>
<overview>
http://www.zillow.com/local-info/TX-Pflugerville/r_47080/
</overview>
<forSaleByOwner>http://www.zillow.com/pflugerville-tx/fsbo/</forSaleByOwner>
<forSale>http://www.zillow.com/pflugerville-tx/</forSale>
</links>
</region>
</localRealEstate>
</result>
</results>
</response>
/SearchResults:searchresults
<!--
H:003 T:51ms S:1114 R:Thu May 21 09:31:53 PDT 2015 B:4.0.15316-release_20150506-quelea.3a71e50-CANDIDATE-040fc91-20150504.232930.3a71e50141702bbc82f14b5302e2b9a06fa41a63.20150505142027508-origin/release/20150506-quelea
-->
How can I get the calculation field or any other field in Podio to show me only parts of the XML file. For example; the XML file has a zestimate number. I would like to get the calculation field to show Zestimate = "zestimate". Thank you in advance for any help.
-
Keeping this alive. Has anyone found a solution?
Avoiding Globiflow, I need to parse and find the information within the XML.
Here's how I'm getting the XML link, using my own zws-ID from Zillow:
ZillowXML_Link
var str = @Property Address.join().split(",")[0].toString().split(' ').join('-');
var zip = @Property Address.join().split(",")[2].toString().split(' ').join('-');
"http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=X1-ZWz1a84vilprm3_82rpe&address="+str+"&citystatezip=" +zipSo that gets me the link. Ideally, I would 'GET' the actual XML into a variable, but I'm not using Globiflow.
I click on the Link, copy and paste the XML into a Text Variable, i.e. ZillowXML_Text.
Then, I'd like to get the ZillowXML_Text parsed so I can get Zestimate for example:
...
<zestimate><amount currency="USD">136905</amount>....Any help appreciated. -
Thanks Gus.
Wanted to share the code I came up with, it works (no GlobiFlow) and it's inspired on the work by sensei Rainer (link here).
//Manual Zillow Pull from XML
//STEP 1: Create Calculated field, I called it: 'Zillow XML Link'
//Get the XML data from here
var dummy = @Unique ID
"http://www.zillow.com/webservice/GetDeepSearchResults.htm?
zws-id=[YOUR API GOES HERE]&address=1828-Spindrift-Dr&citystatezip=92037"
//STEP 2: Paste your XML data into a Text Box
// I called it 'Zillow XML Paste'
//STEP 3: Create Calculated field, I called it: 'Zillow TakeMeAtFaceValue'
function findString(string) {
var a = @Zillow XML Paste; // a is the whole text
var b = "<" + string + ">"; // b is the search string
var c = b.length; // c is length of b
var d = a.indexOf(b); // d is the 1st position of b
var e = c + d; // e is the last position of b
var f = a.indexOf('<', e+1); // f is the next XML tag
return a.substr(e, f-e).replace("\n"," "); // finds the text
};
// Find all these items in the XML tags
var strings = [
["homedetails", "Zillow Link"],
["comparables", "Comps"],
["street", "Street"],
["city", "City"],
["state", "State"],
["zipcode", "Zipcode"],
["latitude", "Lat"],
["longitude", "Lon"],
["zpid", "ZPID"],
["useCode", "Home Style"],
["taxAssessmentYear", "Tax Assessment Year"],
["taxAssessment", "Tax Assessment"],
["lotSizeSqFt", "Lot (sqft)"],
["finishedSqFt", "Floor Size (sqft)"],
["bathrooms", "Bathroom(s)"],
["bedrooms", "Bedroom(s)"],
["lastSoldDate", "Last Sold Date"],
["lastSoldPrice currency=\"USD\"", "Last Sold Price"],
["amount currency=\"USD\"", "Zestimate"],
["last-updated", "Zestimate Update Date"],
["zindexValue", "Zindex"]
];
var show = "";
try {
for (var i =0; i < strings.length; i++) {
show += strings[i][1] + ": " + findString(strings[i][0]) + "\n";
};
} catch(e) {
"N/A";
};Here's what you get:
Zillow Link: https://www.zillow.com/homedetails/1828-Spindrift-Dr-La-Jolla-CA-92037/16839116_zpid/
Comps: http://www.zillow.com/homes/comps/16839116_zpid/
Street: 1828 Spindrift Dr
City: LA JOLLA
State: CA
Zipcode: 92037
Lat: 32.850627
Lon: -117.263058
ZPID: 16839116
Home Style: SingleFamily
Tax Assessment Year: 2017
Tax Assessment: 1.0139323E7
Lot (sqft): 23522
Floor Size (sqft): 11145
Bathroom(s): 5.0
Bedroom(s): 5
Last Sold Date: 07/31/1998
Last Sold Price: 2590000
Zestimate: 14849678
Zestimate Update Date: 09/10/2018
Zindex: 1,742,900
Please sign in to leave a comment.
Comments
8 comments