Link to home
Start Free TrialLog in
Avatar of navgup
navgup

asked on

Group rows with different colors- VERY IMPORTANT 200 points

I want to categories documents in a view and assign a different color to each category docs in the view. I want this to represents clearly what set of docs are together.

for eg.

Column 1         Column 2
Category A
                       Doc A
                       Doc B
                       Doc C

Category B
                       Doc E
                       Doc F
                       Doc G

I want all documents in category A docs to be in one color or shaded and Category B docs in a separate color. This is a Notes application (non-web)

Avatar of cezarF
cezarF
Flag of Australia image

try this in a hidden first column with "use as color" ticked

red := 255:0:0;
blue := 0:0:255;
black:=1:1:1;
plain:=0:0:0;
@If(WD_Category = "Category A"; red:blue; WD_Category = "Category B"; blue:red; black:plain:0:0:0)

hope this helps
Avatar of navgup
navgup

ASKER

I cannot define every category in the column and assign a color. I want to use only 2 colors and have alternate rows withthe same color.
Avatar of navgup

ASKER

to elaborate more:
I want to use only 2 colors and have something like this
Category A docs with color Black
Category B docs with color Blue
Category C docs with color Black
Category D docs with color Blue
how many categories do you have? just enhance the code below.

do this....note the color pairs represents foreground and background accordingly(plain:black= white FG and black BG)

red := 255:0:0;
blue := 0:0:255;
black:=1:1:1;
plain:=0:0:0;
@If(Category = "Category A":"Category C"; plain:black; Category = "Category B":"Category D"; plain:blue; black:plain:0:0:0)
correction...color pairs represents background and foreground respectively(white:black= white BG and black FG)

red := 255:0:0;
blue := 0:0:255;
black:=1:1:1;
plain:=0:0:0;
white:=255:255:255;
@If(Category = "Category A":"Category C"; black:white; Category = "Category B":"Category D"; blue:white; black:plain:0:0:0)
Avatar of navgup

ASKER

I don't know how many categories i m going to have.  It could be unlimited.

That is why i cannot pick altenate rows and assign a color to it.
Avatar of navgup

ASKER

Could you paste some of the content or email it to me at navgup@hotmail.com ?
I cannot access it because we have firewall restriction on this website. pl don't ask me why ..
>>I don't know how many categories i m going to have.  It could be unlimited.
That is why i cannot pick altenate rows and assign a color to it.<<

Using Cezar's color combinations, you need to figure a way to assign categories odd and even values.  Then use @if(@modulo(thisCategoryNumber,2)=0, thiscolor, othercolor)

This may involve on the form to translate the categories into a numeric value, or perhaps getting the first letter of the category and seeing if it's in a list: "A":"C":"D":"F":"H":"J"... but that won't insure that Apples and Avocados be highlighted in different colors.  

If you do this on the form in a computed field at the end of the form, then all you have to do is reference it in the view.

Avatar of navgup

ASKER

Do you know by any chance how to use profile document to establish these colors based on a value ? I found the designer help to be helpless and confusing.

I m trying to get all the categories in a list and append it with a serial no. such as

Category  | SerialNo.

AX1|1;PX2|2;X74|3;X9P|4

When this list is sorted and the serial no. are extracted to compare whether it is even or odd numbers, i think i can define 2 colors, one for odd numbers and second for even numbers.

Now, my problem is how can i define this in a profile doc.

Am i making sense??
Yes. Excellent.   Remember not to edit and save your profile form directly, use the agent to open, the document.  Else it will appear in views and become not a true profile document. What follows is detailed instructions on how to set this up.

Create a Shared Agent to edit the profile document:
---------------------------------------------------------------------------------------
Agent Information:
Name:      Edit Category Mapping
Shared Agent:      Yes
Type:      Formula
State:      Enabled
Trigger:      Manually From Actions Menu
Acts On:      None
Formula:      @Command([EditProfileDocument]; "Category_Mapping");@All;
---------------------------------------------------------------------------------------
CREATE YOUR PROFILE FORM:
Your Profile Form Information:
Form Name:      ($CategoryMapping)
Alias:      Category_Mapping
Type:      Document      
Include in Compose Menu:      No
Automatically Refresh Fields:      Yes
Form May Be Composed By:      All Users or whoever you want to be able to edit this


Add a form Field:      "Form"
Datatype:      Text, hidden
Field Type:      Computed
Default Value Formula:      "Category_Mapping"

Add a Field for your Category Names:      "Category_Name"
Datatype:      Text
Field Type:      Editable


Add a Field for your Category Numbers:      "Category_Number"
Datatype:      Text
Field Type:      Editable

Add a Hotspot Button to concatenate your Category_Name and Category_Number:
Type:      Button
Caption:      Append to List
Formula:      
@If(Category_Name = ""; @Return(@Prompt([Ok]; "Empty Field"; "Sorry you have to enter a Category Name")); "");
@If(Category_Number = ""; @Return(@Prompt([Ok]; "Empty Field"; "Sorry you have to enter a Category Number")); "");
OldList := Category_List;Parsed := Category_Name + "|" + Category_Number;
NewList := @UpperCase(@Sort(@Trim(@Unique(Parsed : OldList))));
@SetField("Category_List"; NewList);@SetField("Category_Name"; "");
@SetField("Category_Number"; "");@Command([EditGotoField]; "Category_Name");

Add a Hotspot Button to Remove an Entry from your List:
Type:      Button
Caption:      Remove From List
Formula:      
CurrentList := Category_List;
Response := @Prompt([OkCancelList]; "Remove Item"; "Select an item to remove from the list"; ""; CurrentList);
@If(Response = ""; @Return(""); "");
NewList := @Trim(@Replace(CurrentList; Response; ""));
@SetField("Category_List"; NewList);

This is the Parsed Field:      "Category_List"
Datatype:      Text
Input Multi-Value Separator(s):      New Line
Display Multi-Value Separator:      New Line
Field Type:      Computed
Formula:      Category_List

Put a SAVE Action,
 @Command([FileSave])

Put a Close action on the form.
 @Command([FileCloseWindow])

Now save your form.
------------------------------------------------

In order for the profile form not to cache, if you have the database open on your workspace, close it.
Now reopen it, select Actions, then select  your agent: "Edit Category Mapping"
The form will open, fill in some values, then save your form.

--------------------------------

Now, on your main database form, you need to add a hidden field at the top of the form to collect your profile field list.
Then, instead of using a DIALOG BOX to collect the value, you have to use a BUTTON and set TWO fields:
The category_name (i.e. PK1) and the category_number( 1, 2, 3)
Else, you will have the number in your view, but not the category, and you can't use the profile field in the view to look that up.

So here are the fields for the DATA form:

Field:      Form
Datatype:      Text, hidden
Field Type:      Computed
Formula:      "Category Parts" << or whatever your form name is.

Field:      theList
Datatype:      Text
Input Multi-Value Separator(s):      New Line
Display Multi-Value Separator:      New Line
Field Type:      Computed for display
Formula:      @GetProfileField("Category_Mapping"; "Category_List");

Hotspot Button "Select a Category"
Type:      Button
Caption:      Select a Category
Formula:      
Nums := "0" : "1" : "2" : "3" : "4" : "5" : "6" : "7" : "8" : "9";
NumList := @Subset(@Subset(@Text(@TextToNumber(Nums *+ Nums *+ Nums)); -999);
@Elements(theList));List := NumList + (". " + @Word(theList; "|"; 1));
Response := @Prompt([OkCancelList]; "Category Selection"; "Please select a category from the list"; ""; list);
@If(Response = ""; @Return(""); "");n := @TextToNumber(@Text(@Word(Response; "."; 1)));
@SetField("Category_Number"; @Word(theList [ n]; "|"; 2));
@SetField("Category_Name"; @Word(theList [ n]; "|"; 1));

Field:      Category_Number
Datatype:      Number
Number Format:      General
Field Type:      Computed
Formula:      Category_Number

Field:      Category_Name
Datatype:      Text
Field Type:      Computed
Formula:      Category_Name

When users click on the "Select a Category" button, they see a list:  
1. PK1
2. PK2
3. Pk3
4. Etc.

When they select a value, we grab the number from the list, and then parse the Category_Name and Category_Number.

Use the Category_Name to sort in your view.
Use the @if(@Modulo(Category_number;2)=0; thisViewColor;ThisOtherViewColor)
ASKER CERTIFIED SOLUTION
Avatar of marilyng
marilyng

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
Oops, let's just indicate that Cezar's posts on how to color code the categories is the other part of the answer.:)