Re: A Minimal PicoLisp DB/GUI Application, Importing twice

2015-01-16 Thread Alexander Burger
On Fri, Jan 16, 2015 at 08:30:47AM +0100, Alexander Burger wrote:
 Then something else must be wrong. The expression

Sorry! My fault!!

Jon was in the unlucky situation of having installed an intermediate
version, where the behavior of '+IdxFold' was just in the process of
small modifications.

With the current version 3.1.9.3 everything works as expected :)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


RE: A Minimal PicoLisp DB/GUI Application, Importing twice

2015-01-15 Thread Jon Kleiser
Hi Alex,

From: picolisp@software-lab.de picolisp@software-lab.de on behalf of 
Alexander Burger a...@software-lab.de
Sent: 15 January 2015 16:42
To: picolisp@software-lab.de
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|p...@no.no|11223344|712582
Pål|Veien 2|p...@no.no|11223345|712583
Espen Askeladd|Veien 3|es...@no.no|11223346|712584
Ola Normann|Veien 4||11223347|712585

Here is the dumped results:

(obj (+Prs) (1 . 7)
   dob 712584
   tel 11223346
   em es...@no.no
   adr Veien 3
   nm Espen Askeladd )
(obj (+Prs) (1 . 19)
   dob 712584
   tel 11223346
   em es...@no.no
   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 p...@no.no
   adr Veien 1
   nm Per )
(obj (+Prs) (1 . 13)
   dob 712582
   tel 11223344
   em p...@no.no
   adr Veien 1
   nm Per )
(obj (+Prs) (1 . 6)
   dob 712583
   tel 11223345
   em p...@no.no
   adr Veien 2
   nm Pål )
(obj (+Prs) (1 . 18)
   dob 712583
   tel 11223345
   em p...@no.no
   adr Veien 2
   nm Pål )
(commit)

/JonPԔ � j)mX�����zV�u�.n7�

Re: A Minimal PicoLisp DB/GUI Application, Importing twice

2015-01-15 Thread Alexander Burger
Hi Jon,

 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|p...@no.no|11223344|712582
 Pål|Veien 2|p...@no.no|11223345|712583
 Espen Askeladd|Veien 3|es...@no.no|11223346|712584
 Ola Normann|Veien 4||11223347|712585

Then something else must be wrong. The expression

   (request '(+Prs) 'nm (pack (car L)))

re-uses an existing object with that name.

BTW, if you want the combination of name and address to be unique, you
could call

   (request '(+Prs)
  'nm (pack (car L))
  'adr (pack (cadr L)) )


Anyway, I imported your data several times, and always end up with 4
objects in the DB.

Perhaps these objects remained from previous experiments? Did you start
with an empty DB? Please remove the adr.db file once, and try again.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe