6 Replies Latest reply: Dec 5, 2012 8:09 AM by Patrick Wolf-Oracle RSS

    Geolocation for mobile application in apex 4.2

    942194
      I want to display a report based on current city of the users.

      This is what i am trying to do:

      I created one JavaScript function with the help of Google map API and fetching the city name and try to set that city name to an ITEM (P1_CITY) on page load, when value of item (P1_CITY) will set i use that value to display the report.

      Problems: it's not setting the value in that item (P1_CITY) for the first time, after second refresh it sets the value in that item. Also my location codes doen't works for some city (don't know why).

      Any help would be appreciated.

      Thanks
        • 1. Re: Geolocation for mobile application in apex 4.2
          Kiran Pawar
          Hello 939191,

          >
          939191 wrote:
          I want to display a report based on current city of the users.

          This is what i am trying to do:

          I created one JavaScript function with the help of Google map API and fetching the city name and try to set that city name to an ITEM (P1_CITY) on page load, when value of item (P1_CITY) will set i use that value to display the report.

          Problems: it's not setting the value in that item (P1_CITY) for the first time, after second refresh it sets the value in that item. Also my location codes doen't works for some city (don't know why).
          >
          How are you setting the value of the item P1_CITY?(through JavaScript or anything else)
          What type of item is P1_CITY?

          Regards,
          Kiran
          • 2. Re: Geolocation for mobile application in apex 4.2
            Prabodh
            Welcome to Oracle Forums!
            Please acquaint yourself with the FAQ and forum etiquette if you haven't already done so.

            Always state
            <ul>
            <li>Apex Version</li>
            <li>DB Version and edition</li>
            <li>Web server used.I.e. EPG, OHS, ApexListner Standalone or with J2EE container</li>
            <li>When asking about forms always state tabular form if it is a tabular form</li>
            <li>When asking about reports always state Classic / IR</li>
            <li>Always post code snippets enclosed in a pair of &#123;code&#125; tags as explained in FAQ</li>
            </ul>
            I want to display a report based on current city of the users.
            This is what i am trying to do:

            I created one JavaScript function with the help of Google map API and fetching the city name and try to set that city name to an ITEM (P1_CITY) on page load, when value of item (P1_CITY) will set i use that value to display the report.

            Problems: it's not setting the value in that item (P1_CITY) for the first time, after second refresh it sets the value in that item. Also my location codes doen't works for some city (don't know why).>

            Item values set with JS do not get set in the session state by themselves. They are typically set in Submit processing, that is why you see this issue only the first time. After refresh (implies submit), second time onwards, the value is in session state.

            Cheers,
            • 3. Re: Geolocation for mobile application in apex 4.2
              942194
              P1_CITY is an page level item
              I am using dummy application process(new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',&APP_PAGE_ID.);) to set the value of item (P1_CITY)

              Thanks
              • 4. Re: Geolocation for mobile application in apex 4.2
                Prabodh
                P1_CITY is an page level item
                I am using dummy application process(new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',&APP_PAGE_ID.);) to set the value of item (P1_CITY)>

                A. The page has to be reloaded after the above code sets the value
                or
                B. The page Item must be set Before Regions are rendered.

                Cheers,
                • 5. Re: Geolocation for mobile application in apex 4.2
                  Kiran Pawar
                  Hello 939191,

                  Can you replicate the same problem on:

                  http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::

                  i.e. Online Oracle APEX and share the credentials of the workspace.

                  Regards,
                  Kiran
                  • 6. Re: Geolocation for mobile application in apex 4.2
                    Patrick Wolf-Oracle
                    Hi 939191,

                    here is what you can do.

                    1) Create a dynamic action which fires on page load
                    2) First action is "Execute JavaScript Code" where you have your JavaScript code to get the location. As soon as you have it use
                    $s( "P1_CITY", value );
                    to write it into your client side page item.

                    3) Second action is "Refresh" on your List View region
                    4) In the List View region you set "Page Items To Submit" to P1_CITY and use it in the WHERE clause of your SQL statement.

                    Regards
                    Patrick
                    -----------
                    My Blog: http://www.inside-oracle-apex.com
                    APEX Plug-Ins: http://apex.oracle.com/plugins
                    Twitter: http://www.twitter.com/patrickwolf