Link to home
Start Free TrialLog in
Avatar of sauce12
sauce12

asked on

Displaying SubCategories in a categories field

I have created a categories field and I am able to create subcategories by using the '\'.  

I am using a formula to create the list of choices for a categories field.  This formula does a dbColumn lookup from a view called "By Category".  Here is my formula currently:  

@Unique(@DbColumn("":"nocache"; ""; "By Category"; 1))

This formula only returns a list of the highest level categories, but does not list the subcategories. Can I create a formula that will return the subcategories as well?

Thanks!



Avatar of HemanthaKumar
HemanthaKumar

Create a view which lists both Cateogory and SubCategory fields... and then use dbcolumn.

or

use the column number where the subcategory is listed in second dbcolumn like this (assuming, subcategory is second col)
@Unique(@DbColumn("":"nocache"; ""; "By Category"; 1)):@Unique(@DbColumn("":"nocache"; ""; "By Category"; 2))


~Hemanth
Sorry sauce12, but this can not be true.

If you request the first column, like:
@Unique(@DbColumn("":"nocache"; ""; "By Category"; 1))

than you get all values from all categories contained in this first column.
All categories from all levels in this first column are separate elements.

You have anywhere else an error.

Where do you see the result from this @DbColumn?

I suggest to you to make for this test in a form a computed for display field containing this @DbColumn as value formula. So you can compare the results.

Avatar of sauce12

ASKER

Hemanth -

Can I create a view containing categories and Subcategories without spliting the those into 2 fields on my form?
In the first column, include formula like this

Category : SubCategory

and sort it and check show as seperate entries in view property.
Avatar of sauce12

ASKER

I want to make sure we are on the same page here.  As I understand, if I create a field named "categories".  It serves as sort of a keyword in notes.  That is, it allows you to create subcategories by entering something like this:  

MainCategory1/SubCategory1

Is this correct about how "categories" is some sort of keyword in notes?

And then when I create a view with the value of the first column as "categories" and check that it is a categorized field - it will display like this:

>MainCategory1
  >SubCategory1
    My document

That works fine for me.

What I want to be able to do is when I use a formula to generate a list of values for my "categories" field.  I would like for it display:
MainCategory1
MainCategory1/SubCategory1

Or something like that, as long as Subcategories are also shown.  I hope that clears things up.  Is this possible?

Zvonko -
 
This is how you think it should work, using the formula I am using now?  You are suggesting that I should get all categories and all subcategories returned to my list if I use that formula?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of zvonko
zvonko

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If that is what you are looking then you have to alter your formula and build a hidden view without category on categories column

The formula goes like this
t := @Unique(@DbColumn("":"nocache"; ""; "By Category"; 1))
t : @Left(t;"\\")

Avatar of sauce12

ASKER

Thanks for the ideas.  I'll play around with it tomorrow morning.  Hemanth - do I need to declare t in the example above.  If so as what?  Thanks.
It is just a temp variable in formula.
Avatar of sauce12

ASKER

Basically, I just needed sort the first column of my view alphabetically instead of making it categorized.  I didn't know that this affected the dbcolumn funtion.  Thanks!
Thank you for the points :-)