Hi Alex,

Now I have got this import thing working. I added the following code at the end 
of the minDbGui.l file:

# To import from tab-separated file, use: (importAddr "myAddrDB.csv")
(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) ) )

If I do the import twice from the same file, then I get duplicates of each 
address in the DB. That’s not a big problem, but if it is possible to prevent 
duplicated names by doing something simple, that could be something I’d like to 
do.

Another observation:
One of the addresses in my DB is "Veien 1, 9999 Byen”. If I search for "1" in 
Address, I get no match, but if I search for "9" in Address, I get a match. Why 
this difference?

If my DB containes very many addresses, say more than 1000, then a search could 
easily match lot more than the 12 that can be displayed at one time in this 
app. If the number of matches also was quite big, then I think it would have 
been nice to see this number down by the back- and forth-buttons at the bottom. 
Is it easy to get hold of this number?

How many addresses do you think this simple app can handle, without operations 
(search, update) getting very slow? More than 100.000? I’m just curious.

/Jon

On 15. Jan, 2015, at 07:57, Alexander Burger <a...@software-lab.de> wrote:

> On Wed, Jan 14, 2015 at 05:54:17PM +0100, Alexander Burger wrote:
>> A simple example would be
>> 
>>   (in "myAdrDB.csv"
>>      (while (split (line) "^I")
>>         (dbSync)
>>         (let Obj (request '(+Prs) 'nm (pack (car L)))
>>            (put> Obj 'adr (pack (cadr L)))
>>            (put> Obj ...)
>>            ... )
>>         (commit 'upd) ) )
> 
> Not correct of course. Better:
> 
>   (use L
>      (in "myAdrDB.csv"
>         (while (setq L (split (line) "^I"))
>            (dbSync)
>            ... L ...
> -- 

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

Reply via email to