Hi Alex, ________________________________________ From: [email protected] <[email protected]> on behalf of Alexander Burger <[email protected]> Sent: 15 January 2015 16:42 To: [email protected] Subject: Re: A Minimal PicoLisp DB/GUI Application, Importing
Hi Jon, > (de importAddr (F) > (let (Cnt 0 L NIL) > (in F > (while (setq L (split (line) "^I")) > (dbSync) > (let Obj (request '(+Prs) 'nm (pack (car L))) > (put> Obj 'adr (pack (cadr L))) > (put> Obj 'em (pack (caddr L))) > (put> Obj 'tel (pack (cadddr L))) > (put> Obj 'dob (format (pack (get L 5)))) ) > (commit 'upd) > (inc 'Cnt) ) ) > (prinl "Lines read: " Cnt) ) ) OK, fine. Looks good :) > If I do the import twice from the same file, then I get duplicates of > each address in the DB. This is strange, and should not be the case. Are you sure? The 'request' prevents that, as long as the names 'nm' are different. ... ♪♫ Alex ____________________________________________ Yes, I have now repeated my experiment from scratch, importing same file twice. I get duplicates. Here is my myAddrDB.csv file, just replace the vertical bars with tabs: Per|Veien 1|[email protected]|11223344|712582 Pål|Veien 2|[email protected]|11223345|712583 Espen Askeladd|Veien 3|[email protected]|11223346|712584 Ola Normann|Veien 4||11223347|712585 Here is the dumped results: (obj (+Prs) (1 . 7) dob 712584 tel "11223346" em "[email protected]" adr "Veien 3" nm "Espen Askeladd" ) (obj (+Prs) (1 . 19) dob 712584 tel "11223346" em "[email protected]" adr "Veien 3" nm "Espen Askeladd" ) (obj (+Prs) (1 . 12) dob 712585 tel "11223347" adr "Veien 4" nm "Ola Normann" ) (obj (+Prs) (1 . 26) dob 712585 tel "11223347" adr "Veien 4" nm "Ola Normann" ) (obj (+Prs) (1 . 2) dob 712582 tel "11223344" em "[email protected]" adr "Veien 1" nm "Per" ) (obj (+Prs) (1 . 13) dob 712582 tel "11223344" em "[email protected]" adr "Veien 1" nm "Per" ) (obj (+Prs) (1 . 6) dob 712583 tel "11223345" em "[email protected]" adr "Veien 2" nm "Pål" ) (obj (+Prs) (1 . 18) dob 712583 tel "11223345" em "[email protected]" adr "Veien 2" nm "Pål" ) (commit) /JonPԔ � &j)m����X�����zV�u�.n7�
