This topic is locked

No duplicate field entrees

9/23/2008 6:34:45 AM
PHPRunner General questions
S
shoppy author

Hi all,
I build just a very simple addressbook in phprunner for usage in a much bigger database.
This adressbook is filled with addresses that comes from excel sheets.

So every time new excel sheets are read into the adressbook and sometimes the adresses are duplicates.
Is there a way to tell phprunner (addresbook) that the adress is already there is not added to the addressbook?
---

This is what I do:

  1. I read adresses of businesses from the internet.
  2. these adressen are stored into a excel-file
  3. I read this excel-file into an addressbook build with phprunner.
  4. the addressbook gets biiger every day but contains duplicate addresses (the same business-adress)
    Can anyone help me to avoid this?
    Thanks a lot,
    John

Sergey Kornilov admin 9/23/2008

John,
Use BeforeAdd/BeforeEdit events to check for duplicates.
Sample action "Check if record exists" will be a good start.

S
shoppy author 9/23/2008

John,

Use BeforeAdd/BeforeEdit events to check for duplicates.
Sample action "Check if record exists" will be a good start.


Hi Sergey,
Ok, tried this.
Now this is what is in the line:

global $conn;

$strSQLExists = "select VacatureBron from _bedrijven where VacatureBron='".$values["VacatureBron"]."'";

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

$data=db_fetch_array($rsExists);

if($data)

{

echo "<center><b><font color=red>Company already exists in database!</font></b></center>";

return false;

}


Now this works fine with adding by hand. But does nothing by importing an excel-file.
The result should be a refusing of adding the record from the excel-file that is being read in by 'import'
Do you understand what I mean?
regards,
John

Sergey Kornilov admin 9/23/2008

If you talking about PHPRunner import feature you need to modify import.php file adding this code.
At this moment import routine doesn't support events that you can use for this purpose.
Another idea - mark VacatureBron as a key column in PHPRunner. In this case import routine will check if this key exists automatically.