Document Library Template

Hi,

I've been trying to implement a document library, and decided to use the default template from Lotus Notes.

I tried to organize my files into different folders, something like save saving the fields under different categories. But to my dismay, I find that I cannot directly create the new doc under the folder. I have to go to the "All Documents" view, and pull the file (or link) into the folder. So I thought, this is no good, doing a job twice, so I began exploring category.

I'm happy that I can create sub category (SubCatB) by doing: CategoryA\SubCatB when creating a message. Then I found that this sub-category is being listed as one of my option for categories. But when I create the next document using "SubCatB"(select from the list), this become a new category showing on the screen.

Is there a way that I can edit the template such that the sub category will appear as "CategoryA\SubCatB", so that I can always put the files into the correct categories? Or can I do something to the folder method?

Thanks!

LVL 1
sataAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CRAKCommented:
Create a new view, hidden (i.e. prefix "(").

Use the selection formula as used in the view "ByCategory":
   Formula:
   SELECT !@Contains(@LowerCase(form); "archive")

Create 1 column (only 1 required):
   Field
   Categories

In the columns properties: set sorting to "Ascending" and select "Show multiple values as separate entries". Do NOT categorize!

Save the view (remember or copy the name for later use).

Now open the form "Document". On it you'll find a field "WebCategories" and one called "Categories". In the field properties, 2nd tab, under choises, you'll find a reference to the view "ByCategory". Change that reference to your new viewname.

That's all! Well... you may have to prevent the designer task on the server to overwrite these changes. Either disconnect the database from its original template, or mark the new view and the changed document as "Prohibit design replace or refresh to modify" (properties, from within the list of forms/views).

One additional remark:
Both formulas (in the fields options) use @DbColumn. That formula is limited to a 64kb result.
If your database grows over that limit in time, your only option will be some kind of an error. For the best way to get around that in future... consult the formula "@Picklist"!
sataAuthor Commented:
Hi,

I have tried, but now this view does not display in a tree format. Also, if I create more than 1 document in the same category, the category for selection becomes more than 1.

How can I solve these?

Thanks.
CRAKCommented:
You're right.
I think the best way to solve this problem AND to avoide the 64k limit is to use a different separator between categories and subcategories.
If we let the views and the document perform some kind of a translation, it would work just as natural as the original template.
I choose "/" as replacement separator for "\". Be careful not to use "/", unless you intend to place a category separator!

Based on the modifications in my previous comment, categorize the (1st) column view "FullCat", and change its formula to:
   @ReplaceSubstring(Categories; "\\"; "/")

(Categorization will filter duplicate entries and reduce the risk of reaching the 64k limit.)

In form "Document", add a translation formula to WebCategories:
   @Unique(@ReplaceSubstring(WebCategories; "\\"; "/"))

In the field Categories, change the existing translation formula to:
   Tmp := @If(
      @ClientType = "Notes";
      @Trim(@Unique(Categories : WebCategories : NewCats));
      @Trim(@Unique(WebCategories : NewCats)));
   @Unique(@ReplaceSubstring(Tmp; "\\"; "/"))

(This will replace any "\" with a "/" in those fields, so the selected values -when editing- will match the ones presented by the view)
The formula to retrieve the list of choises needs no additional change.

The 1st column in view "ByCategory" should be changed to:
   @ReplaceSubstring(Categories; "/"; "\\")

(That will restore the original "/" for every "\" to allow automatic splitting of categories and subcategories)


You will now be able to enter new subcategories using either "/" or "\". They will automatically be translated to "/" to present them "flat" in the list of choises and translated back to "\" in the category view.

Although existing documents will show both Cat\Subcat and Cat/Subcat in the list of choises (a combination of current values and translations in the list of choises), a conversion of existing documents should not be neccessary! Even if you select both Cat\Subcat and Cat/Subcat on one document, the category field will turn out right: Cat\Subcat will first be translated to Cat/Subcat (causing a duplicate entry), followed by @Unique removing all duplicates in those fields!

Enjoy!  ;-))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

spacediverCommented:
Hi Crak & sata,

I am new to Lotus Notes and had tried your comment to sata in lotus notes designer.

I hope you don't mind that i had tried your method.  Ü

After trying I was a bit confused where the paragraph you'd mentioned :
Based on the modifications in my previous comment, categorize the (1st) column view "FullCat",
and change its formula to:
   @ReplaceSubstring(Categories; "\\"; "/")

I had problem locating the (1st) column view "FullCat".

Are you refering to the initial formula that you'd mentioned?
SELECT !@Contains(LowerCase(form); "archive")

Do you mean by replacing the formula?

Regards,
CRAKCommented:
Sorry about that...
In my 1st comment I wrote about a new hidden view to be created. In the database that I created here to support this question I called it "FullCat" (as alias, "(FullCat)" as front-end name). However, I never suggested to use that name. You're free to change it as you wish of course.

If everything goes well, you should have made following modifications:
- this new view that I called "FullCat",
- two references to this view: the "Choises" formula of the fields "Categories" and "Webcategories" on form "Document"
- translation formulas in these two fields
- the 1 column in view "ByCategory"
sataAuthor Commented:
Hi CRAK,

I used your code, and made some modifications, and now it works! Thanks!
CRAKCommented:
;-)
Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.