Creating a new category in a giving library

N

nour

Guest
Hi, please how can I create e new category in one giving library?
I've tried the following:

libId=ddGetObj("libName")
ddCatOpen(libId "newCat" "a")

But it doesn't work...
 
Salam Nour,

My understanding is If you create a category using skill without
adding anything into it, then it wouldn't get physically created I'm
afraid. In other words, it wouldn't be added into the lib.TopCat file.
I honestly don't know why, my guess is my be to optimize the database
and avoid useless empty things hanging around. Other chaps my have the
'true' right explanation.
My advice is to create the category, add a cell into it, save it and
then close it. There is an example :
;
myCat = ddCatOpen(ddGetObj("rkWorkLib") "rkCatForNour" "a")
ddCatAddItem(myCat "rcFilter" "cell")
ddCatSave(myCat)
ddCatClose(myCat)
;

You can use : ddCatGetLibCats(ddGetObj("rkWorkLib")) if you want to
check ...
Let me know if this works for you.

Regards,
Riad.
 
Riad KACED wrote, on 10/29/08 17:46:
Salam Nour,

My understanding is If you create a category using skill without
adding anything into it, then it wouldn't get physically created I'm
afraid. In other words, it wouldn't be added into the lib.TopCat file.
I honestly don't know why, my guess is my be to optimize the database
and avoid useless empty things hanging around. Other chaps my have the
'true' right explanation.
My advice is to create the category, add a cell into it, save it and
then close it. There is an example :
;
myCat = ddCatOpen(ddGetObj("rkWorkLib") "rkCatForNour" "a")
ddCatAddItem(myCat "rcFilter" "cell")
ddCatSave(myCat)
ddCatClose(myCat)
;

You can use : ddCatGetLibCats(ddGetObj("rkWorkLib")) if you want to
check ...
Let me know if this works for you.

Regards,
Riad.
Riad's right. Categories get purged if there's nothing in them any more. So if
you create one without adding anything in it, it also gets purged...

Regards,

Andrew.
 
Hi Andrew,

There is one confusing bit though. When you hand-create the category
from the libManager, it gets created even though it remains empty. It
does not get purged; the 'category.Cat' file is created. Any comments
about this ?

Regards,
Riad.
 
Riad KACED wrote, on 11/02/08 22:33:
Hi Andrew,

There is one confusing bit though. When you hand-create the category
from the libManager, it gets created even though it remains empty. It
does not get purged; the 'category.Cat' file is created. Any comments
about this ?

Regards,
Riad.
Hi Riad,

Sorry for the rather late reply - I've been busy trying to catch up on the news
group having been tied up for a while.

Anyway, if you look at the SKILL function ddCatOpenEx(), you'll see it has a
fourth argument to control whether it will preserve empty categories or not.
ddCatOpen() does not have this option, and is equivalent to not preserving empty
categories.

The library manager uses the mode to preserve empty categories.

Regards,

Andrew.
 
No worries Andrew, better late than never :)
I was busy with other things anyway, mainly distracted by the end of
year tapeouts and other objectives ...

Thanks for your enlightening indeed.
Riad.
 

Welcome to EDABoard.com

Sponsor

Back
Top