Post

2 followers Follow
0
Avatar

How to add variables in globiflow?

I am pulling zillow data in globiflow

 

numsqf1 = number_format(preg_match_gf("/<finishedSqFt>(.*?)<\/finishedSqFt>/ism",[(Variable) strZillowResponseDeep1],1))

numsqft2 = number_format(preg_match_gf("/<finishedSqFt>(.*?)<\/finishedSqFt>/ism",[(Variable) strZillowResponseDeep2],1)) 

numsqft3 = number_format(preg_match_gf("/<finishedSqFt>(.*?)<\/finishedSqFt>/ism",[(Variable) strZillowResponseDeep3],1))

numsqft4 = number_format(preg_match_gf("/<finishedSqFt>(.*?)<\/finishedSqFt>/ism",[(Variable) strZillowResponseDeep4],1))

numsqft5 = number_format(preg_match_gf("/<finishedSqFt>(.*?)<\/finishedSqFt>/ism",[(Variable) strZillowResponseDeep5],1))

 

avgSqFt = number_format(([(Variable) numsqft1] + [(Variable) numsqft2] + [(Variable) numsqft3] + [(Variable) numsqft4] + [(Variable) numsqft5])/5,1)

 

numsqft1 = 1,768

numsqft2 = 1,585

numsqft3 = 1,849

numsqft4 = 1,120

numsqft5 = 1,365

 

It gives me

avgSqFt = 1

instead of avgSqft = (1768+1585+1849+1120+1365) / 5 =  1537.4

 

Please help help!

Thank you!

 

 

Joseph Nguyen

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Joseph,
number_format() parses a number to a string - but you can't do an addition with strings. In the variable avgSqFt  you must re-parse th strings to a number. 


avgSqFt = number_format((floatval([(Variable) numsqft1]) + floatval([(Variable) numsqft2]) + floatval([(Variable) numsqft3]) + floatval([(Variable) numsqft4]) + floatval([(Variable) numsqft5]))/5,1)

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink