This topic is locked
[SOLVED]

 Import Customer File

7/18/2017 7:54:11 AM
PHPRunner General questions
lefty author

I have a question regarding importing data to a table with a field setup as a map. I originally did the geocoding on the original table. I imported some records later and noticed that

the lng/lng fields updated automatically . Is this a feature with PHPrunner 9.7 + or did they update auto because the address fields were filled out from raw table . I thought I would have to select those records first then hit save all to update. If not that's great. Reason I needed to confirm as I also have duplicates and can find them after import if the lat/lng fields were not filled in , but guess not . I guess that's good , will have to run a special query to find dup's as event to not add dups on two fields before insert times out. Can someone confirm that phprunner does this or it is just picking up the lat/lng because address is filled out in import file? it's makes a difference on how I design the query to check for duplicate records . Thanks

HJB 7/18/2017

https://xlinesoft.com/phprunner/docs/_view_as__settings_map.htm (ex v9.7 manual)
See the CHECKBOX inside 3rd screenshot from top where one can explicitely switch the UPDATE to be ON or OFF. On built-in PHPR named "Prevent duplicate values" (can be switched ON and OFF inside the EDIT field properties menu) it seems to be as well a nice and useful feature to avoid boring and tiring manual coding to eliminate duplicates after imports. HTH

HJB 7/20/2017

John, how far? Look, I had been killing precious time on map issues longer time ago in regard to BING, GOOGLE and OPENSTREETMAP and while the import of GPS data is just in second row, your clients may want to make use of filtered maps under dashboard technology, of course with several different icons per map location and of course want to enjoy to see the map descriptions in their own language too (tested several handling menu languages and it workd fine), say, I found the best solution for me to collect product demands per region, to display the nearest distributor and his contact address plus of course a summary on the bottom line of regional actual or pending orders per item to let the web page viewer a fully transparent picture of volumes, amounts, in short, what counts in product and service marketing. I have to admit, it is hard to sell such mapped filtering, yet thanks to bootstrap and responsiveness, marketing is going to become a real fun (at least for me).

lefty author 7/21/2017



John, how far? Look, I had been killing precious time on map issues longer time ago in regard to BING, GOOGLE and OPENSTREETMAP and while the import of GPS data is just in second row, your clients may want to make use of filtered maps under dashboard technology, of course with several different icons per map location and of course want to enjoy to see the map descriptions in their own language too (tested several handling menu languages and it workd fine), say, I found the best solution for me to collect product demands per region, to display the nearest distributor and his contact address plus of course a summary on the bottom line of regional actual or pending orders per item to let the web page viewer a fully transparent picture of volumes, amounts, in short, what counts in product and service marketing. I have to admit, it is hard to sell such mapped filtering, yet thanks to bootstrap and responsiveness, marketing is going to become a real fun (at least for me).


I guess I should have added another topic as my main issue is upon import My query blows out around the 100 - 200 records and still adds all records / So I have duplicates . It is supposed to check before insert/import to see if there is already a CustomerID and a EmployeeID assigned to raw data before insert . I have to import monthly . It is not something I do manually , So in edit records prevent duplicates won't stop import . Unless I am missing something here.
$strSQLExists="select * from Customers where CustomerID=" . $rawvalues["CustomerID"]. " AND EmployeeID=' " . $rawvalues["EmployeeID"] . " '";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{
return false;
} else {
return true;
}
I think I have to add a loop here?
Anyway Walkfly ; Intrested in how you display the nearest distributor - in my case the nearest customer . I checked google map API but can't seem to incorporate a field that will just fill in the nearest customer and Customer ID based on lat/lng from my mysql database. I use edit as ajax and it works fine , but I would prefer my mobile users have the Customer and CustomerID popup in the fields based on their location. Thanks for the info.

HJB 7/21/2017

John, 1st some basics: Either you drop LNG/DAT manually or by import under unchecked UPDATE hook in the map properties (which practically means, the Google API won't look for map icon address detail at all and as well means, those now free address fields can now server for any text string you want to see there to popup in the map) or you use checked UPDATE HOOK (which practically means, the Google API is doing the update in accordance with what is seen as per address details, once UPDATE is unchecked, you can use such fields to drop anything you want to see by popup in tzhe map in such fields).

Further, in regard to regular updates of the map details, it is recommendable to avoid differences between your client ID data and what is dumped inside the map details. Say for example, you get new clients, other clients go, so you client DB is changing regularly while it could happen then, you are listing client IDs in the map which are no longer in existence any longer or you need to add (update) new ones, leading to trouble by means of non-actualized data being mapped. These days, I mean by registration page on user to drop their details first to finally be awarded a login and password after the registration page, I would recommend to add LNG/LAT fields to the user table.
By the way, http://www.mapcoordinates.net/en is a useful tool for clients to add their own LAT/LNG data into e.g. a registration page then.
Anyway, now you can grab the client DB originating LAT/LNG into the map by means of AUTO-FILL feature, same refers of course to client ID and name to later popup in the map.
Earlier Sergey and his developer team had been as well presenting an online demo where one could see SEVERAL icons per one map location, visually indicating by optical of what else services or classifications of all kinds, just fyi in regard to improvements on the map later on.
As the map viewer is usually knowing his own map location, such map viewer needs to center himself in the map by mouse to see what is the nearest next map icon to his own location.
Now to the two different terms named IMPORT and UPDATE which are to different kind of shoes anyway. It is my understanding that the CSV import feature under PHPR is only touching the term IMPORT, but not UPDATE. So, whatever you try to code manually, PHPR's import functionality is NOT updating, but just importing data. There are numerous methods out there to convert CSV import data into SQL (e.g. http://www.convertcsv.com/csv-to-sql.htm ) to then make either use of PHPmyADMIN update feature then or to use other MySQL software (partially available as even freeware) to run the UPDATE.
I personally prefer to run maps in dashboards, say, the map on the left, and client ID etc pp in a table seen on the right (see demo under: https://www.xlinesoft.com/livedemo/phprunner/livedemo81/Dashboard_map_dashboard.php ) and with some amendments on the table, even things like SUM, COUNT, AVERAGE can appear on the bottom line too, plus of course clickable e-mail addresses or URLs while you know, the PHPR built-in features are endless.
Finally, I prefer BING rather than GOOGLE as it came to light that only BING supports PHPR's built-in handling menu language options, say, for example, you would own a golf client in China, using the Chinese handling menu language then by linkn or dropdown on your web apppliance, very same would see the map descriptions in CHINESE too (like e.g. ocean names etc pp) while the Google map does not.

lefty author 7/22/2017



John, 1st some basics: Either you drop LNG/DAT manually or by import under unchecked UPDATE hook in the map properties (which practically means, the Google API won't look for map icon address detail at all and as well means, those now free address fields can now server for any text string you want to see there to popup in the map) or you use checked UPDATE HOOK (which practically means, the Google API is doing the update in accordance with what is seen as per address details, once UPDATE is unchecked, you can use such fields to drop anything you want to see by popup in tzhe map in such fields).

Further, in regard to regular updates of the map details, it is recommendable to avoid differences between your client ID data and what is dumped inside the map details. Say for example, you get new clients, other clients go, so you client DB is changing regularly while it could happen then, you are listing client IDs in the map which are no longer in existence any longer or you need to add (update) new ones, leading to trouble by means of non-actualized data being mapped. These days, I mean by registration page on user to drop their details first to finally be awarded a login and password after the registration page, I would recommend to add LNG/LAT fields to the user table.
By the way, http://www.mapcoordinates.net/en is a useful tool for clients to add their own LAT/LNG data into e.g. a registration page then.
Anyway, now you can grab the client DB originating LAT/LNG into the map by means of AUTO-FILL feature, same refers of course to client ID and name to later popup in the map.
Earlier Sergey and his developer team had been as well presenting an online demo where one could see SEVERAL icons per one map location, visually indicating by optical of what else services or classifications of all kinds, just fyi in regard to improvements on the map later on.
As the map viewer is usually knowing his own map location, such map viewer needs to center himself in the map by mouse to see what is the nearest next map icon to his own location.
Now to the two different terms named IMPORT and UPDATE which are to different kind of shoes anyway. It is my understanding that the CSV import feature under PHPR is only touching the term IMPORT, but not UPDATE. So, whatever you try to code manually, PHPR's import functionality is NOT updating, but just importing data. There are numerous methods out there to convert CSV import data into SQL (e.g. http://www.convertcs.../csv-to-sql.htm ) to then make either use of PHPmyADMIN update feature then or to use other MySQL software (partially available as even freeware) to run the UPDATE.
I personally prefer to run maps in dashboards, say, the map on the left, and client ID etc pp in a table seen on the right (see demo under: https://www.xlinesof...p_dashboard.php ) and with some amendments on the table, even things like SUM, COUNT, AVERAGE can appear on the bottom line too, plus of course clickable e-mail addresses or URLs while you know, the PHPR built-in features are endless.
Finally, I prefer BING rather than GOOGLE as it came to light that only BING supports PHPR's built-in handling menu language options, say, for example, you would own a golf client in China, using the Chinese handling menu language then by linkn or dropdown on your web apppliance, very same would see the map descriptions in CHINESE too (like e.g. ocean names etc pp) while the Google map does not.


Thanks for the feedback. I will have to look for another solution to look for duplicates before import I guess. I looked at an older project I had from 8.0 and the above query was working. I do recall that I had to split the import file as it was too large and query timed out . I guess that functionality of checking for specific record and return false dosen't work with before insert no longer.

HJB 7/23/2017

https://stackoverflow.com/questions/9472562/csv-import-to-mysql-for-update
... for inspiration purposes only ..., there are tons of other ways to update MySQL data anyway. Some weeks ago there was a query on this forum on how to update, say, there are regions on this plant where the Internet is not present all the time, so, that very PHPRunner is using the built-in offline option of PHPR and once the Internet is getting back, the synchronization of the offline data with what had been already online in the database has to happen then.

lefty author 7/23/2017



https://stackoverflo...ysql-for-update
... for inspiration purposes only ..., there are tons of other ways to update MySQL data anyway. Some weeks ago there was a query on this forum on how to update, say, there are regions on this plant where the Internet is not present all the time, so, that very PHPRunner is using the built-in offline option of PHPR and once the Internet is getting back, the synchronization of the offline data with what had been already online in the database has to happen then.


As of now I do the import . I need an easy import method for the user , who is not IT savy . I had this working in 8.0 but had to split so it would not time out . I need basically a check for duplicate , if duplicate return false , if not return true . I don't understand what you are trying to get at .

It's pretty simple event before insert if exists don't import if don't exist then import . If PHPrunner cannot do this it should be noted in the manual as if you look at it , it states check if specific record exists , return false , if not return true . IF this is not the case then they need to change the manual. This is just a simple query , in fact If I test it with say 5 records it works.

HJB 7/24/2017

https://xlinesoft.com/phprunner/docs/export_import_pages.htm
Quote excerpt

PHPRunner adds the new records or updates the existing ones while importing.

During import PHPRunner will try to insert a new record first. If insert fails for any reason like duplicate primary key it will try to locate and update this record with new data.

It will update the existing records instead of adding them in the following case:



  1. A primary key is defined for the table in question.


  2. Key fields selected on the 'Choose pages' screen match the primary key in the database.


  3. Primary key column or columns exist in the file being imported.

    unquote excerpt
    John, we have a saying here in Germany: HE WHO CAN READ OWNS CLEAR ADVANTAGES IN BUSINESS, say, I don't like the tenor of your lines at all and tell you this: No more comments by me to any of your issues at all, now and forever.

lefty author 7/24/2017



https://xlinesoft.co...mport_pages.htm
Quote excerpt

PHPRunner adds the new records or updates the existing ones while importing.

During import PHPRunner will try to insert a new record first. If insert fails for any reason like duplicate primary key it will try to locate and update this record with new data.

It will update the existing records instead of adding them in the following case:



  1. A primary key is defined for the table in question.


  2. Key fields selected on the 'Choose pages' screen match the primary key in the database.


  3. Primary key column or columns exist in the file being imported.

    unquote excerpt
    John, we have a saying here in Germany: HE WHO CAN READ OWNS CLEAR ADVANTAGES IN BUSINESS, say, I don't like the tenor of your lines at all and tell you this: No more comments by me to any of your issues at all, now and forever.


Sorry for not understanding some of your answers . But this is what I was looking for . So it should work . Link Topic