Comments

21 comments

  • Rainer Grabowski

    Hi Andreas,

    to get them in the same app (i.e.: extract in the same item):

    var a = @map.join();
    a.split(",")[0]   
    

    This would return the street.
    [0] = Street
    [1] = Zip+City
    [2] = State
    [3]= Country

    To get them in a related app if there is only one item with an address field related:

    var a = @all of map.join();
    a.split(",")[0]
    

    If there are are multiple items related:

    var a = @all of map;
    result = [];
    for(var i = 0; i < a.length;i++){
    result.push(String[a[i]).split(",")[0]);
    };
    result.join("\n")  
    

    This would return all streets as a list

    Rainer

    2
    Comment actions Permalink
  • Andreas Forstinger

    Thanks Rainer! Your solution works of course very well.

    I was unclear in my question - especially I wanted to get the coordinates. Looking at https://developers.podio.com/doc/items#location it seemed the values are internally stored seperated and I wondered if I could access them like @location.[lat] or @location.["lng"] in a calculation.

    1
    Comment actions Permalink
  • Rainer Grabowski

    As far as I know it's not possible to pull lat/lng with a calculation.

    0
    Comment actions Permalink
  • Andreas Forstinger

    As I still have not found a solution for it: if I have an app with a location field e.g. "customers", how could I use the address data to filter my items based on country and city? This is something so basic that I wonder not every user having any kind of address data is requesting this?

    With Rainer's solution I could have calculated fields showing the country but as this is text data and Podio obviously does not like text data it is up to no good except that I can export and then easily filter in Excel.
    For now we still need to have additional category fields holding every possible country and our users must input data redundantly. Not cool at all!

    0
    Comment actions Permalink
  • Dean Dang

    Hello. 

    I was able grab the CITY. Thanks Rainer. How do you get CITY, STATE? Thanks for any help. 

    0
    Comment actions Permalink
  • Mark Cannon

    When I tried this in the same app, I got:

    [0] = Street address

    [1] = City

    [2] = State+ " "+Zip

    [3] = Country

    This is apparently because the addresses are broken by "," at those locations.

    Could it be different for the USA addresses I was parsing?

    -Mark

    1
    Comment actions Permalink
  • Mark Cannon

    Dean,

    I was able to get City, State using the following:

    var a = @Map.join();
    a.split(",")[1]+", "+a.split(",")[2].split(" ")[1]

    Not sure what your result will be regarding my previous comment.

    -Mark

    4
    Comment actions Permalink
  • Dean Dang

    Hey thanks Mark. That worked. 

    0
    Comment actions Permalink
  • Nicolas Roegiers

    Hi, i have a similar question. In the app 1 i want a calculation field to return the zipcode that is mentioned in app 2 in a location field. There is an outgoing relationship from app 1 to app 2. Anyone knows what code i have to use?

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Nicholas,

    normally the zip code is the last number in a location field (the street number is always before the zip code, cities and countries normally don't have a digit in their name). In my country Germany, in France or in the USA the zip code has always 5 digits (don't know how the zip code looks like in your country).

    This given the zip code can be extracted very simple by deleting all other characters (and spaces etc.) and then extracting the last 5 digits:

    @location field.join().replace(/[^0-9]/g,"").substr(-5) 

    Another way I've described in this community post (see my first comment there).

    Rainer

    1
    Comment actions Permalink
  • Nicolas Roegiers

    Hi Rainer,

    As always your solution worked out. Thanks.

    I have another problem regarding calculation fields giving null as a result when a field is empty.

    In an app i have following fields :

    1. reference field

    2. date field

    3. text field

    I want to have a calculation field that shows the content of these 3 fields in the following way:

    @all of title(reference field) + " - " + moment(@date field).format("DD/MM/YY") + @text field 

    But when either the date field or text field is empty i don't want a "null" to show up in my calculation field. 

    Do you know what code i have to use?

    Greets,

    Nicolas

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Nicolas,

    you can do it this way: 

    (@all of title(reference field) + " - " + moment(@date field).format("DD/MM/YY") + @text field ).replace(/null/g,"")

    That replaces all occurrences of  "null" (even if both, date and text, are empty), but leaves the dash (which is unnecessary when both other values are missing). For that you can enter: 

    var ref = @all of title(reference field);
    var date = moment(@date field).format("DD/MM/YY");
    var text = @text field;
    var title = text == null && date == null && ref != "" ? ref : (text != null || date != null) && ref != "" ? ref + " - " + date + text : ""
    title.replace(/null/g,"")

    Rainer

     

    0
    Comment actions Permalink
  • Christopher Gibbins

    I tried this as well and I am not getting the same results. Here is my code

    var a = @Address.join();
    a.split(",")[0]
    "http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=<ZWSID>&address=" + a.toString().split(',').join('+')[0] + "&citystatezip=" + a.split(' ').join('+')[2]

     

    When I use this I get the following

    http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=<ZWSID>&address=8&citystatezip=5

    0
    Comment actions Permalink
  • Gus H.

    Hi Andreas. I would suggest you do a search for Scott Costello's JSON entry, either in YouTube or go to his site strugglinginvestor.com. Tons of free info, too. Our Podio community will be always indebted to him for all the time and effort he has put in. From day one, he has shared all the details of his progress, and NEVER asking for anything in return. We do owe him at least a big, huge THANK YOU.

    2
    Comment actions Permalink
  • Andreas Forstinger

    Hi Gus,

    thanks for pointing me there. Actually we went a similar route also using the Google Geocoder  - we just do not store it in a JSON field. We also do not use flows but PHP scripts called by hooks. It is great that there are lots of such workarounds, but it is also my feeling that we should not need to use them. Having JSON data in text fields is not very user friendly at all :)

     

     

    0
    Comment actions Permalink
  • Teresa Cutrona

    Hello,

    is possible use formula to get just city from adress map?

    Actually I'm using this formula: @All of address.join("\n")

    but I want to show just city 

    my structure map is the following:

    Adress

    zip code

    City

    State

    Nation 

    Thank you :)

    0
    Comment actions Permalink
  • Wendell Hankins

    Any Help please advise any way to pull the State into its own field the Zip Code works great. 

    1
    Comment actions Permalink
  • Conor O'Donoghue

    Hi all - 

    I'm having some issues with proper execution of this. 

    I want to isolate "state" from an address field.

    Here's what I have:

    var a = @Clinic Address.join();
    a.split(",")[2]

    However, it is returning state and zip, for example " CA 12345"

    To ensure consistency in entering addresses, we are always diligent about using the auto-prompted address that shows up to suggest the correct address when typing it into the address field. 

    Any guidance would be helpful.

    Conor

     

     

     

     

    0
    Comment actions Permalink
  • John Stiles

    Thanks for all of the information shared here. 

    I have been able to apply this to my situation to display just the city in one field and just the zip code in another field.

    This displays just the zip code.

     

    This displays just the city

     

    My issue is that I have multiple items being referenced but the calculation is only displaying one of them. I tried to use what was suggested 

    ---

    var a = @all of map;
    result = [];
    for(var i = 0; i < a.length;i++){
    result.push(String[a[i]).split(",")[0]);
    };
    result.join("\n") 

    ---

    but this results in an error message. 

    Can you help me to display the information for all of the items referenced? Thanks.

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi John, 

    it's always helpful to know the error notification. 
    I've seen one typo in your code: 
    String[a[i])
    must be 
    String(a[i])
    ( instead of [ before a[i]

    Rainer

    0
    Comment actions Permalink
  • Richard Mercado

    Hi John,

    I have the following fields in My Excel file:

    Address (street)

    City

    State

    Zip Code

    How do I get my various Excel fields to import into my Seller Leads app "Property Address" field joined, so that my related fields "Street Map" and "Zillow Link" calculate the address properly? These fields need the complete address to function properly. 

    Here is my current "Street Map" calculation, as it defaulted:

     

    var prop = @Property Address;

    "![alt-text](https://maps.googleapis.com/maps/api/streetview?size=600x300&location=" + prop + "&fov=70)"

     

    Here is my current "Zillow Link" calculation, as it defaulted:

     

    var url = @Property Address
    if(url){
    "http://www.zillow.com/homes/"+url.toString().split(' ').join('-') +"_rb"
    }

     

    Thanks!

     

    Rich

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk