Fill Field with Colornumbers

Agamemnon

Registered User.
Local time
Today, 08:01
Joined
Sep 18, 2003
Messages
24
Hi,

I have a table of products (+/- 1000) and I want to create a new field with color numbers (eg 255 = Red) in it. These colors should be unique for every product and once I have a new product the field should automatticaly generate a new non existing color number. How can I easily fill this field with the numbers and is the automatisation procedure possible?
Thx
Agamemnon
 
You don't say what you intend to do with this number, so I won't go there. In the absence of a statement of purpose, you have the ability to generate a little over 16 million colors this way. You need a LONG (integer) to hold the 24-bit number that you will be generating.

You didn't say whether the colors meant anything. You didn't say whether you cared about how close two colors came to each other. Therefore, I will assume that random colors are as good as any other. You can generate random colors by using the RND function (plus, of course, RANDOMIZE), both of which are in the Help files. You want to generate three random numbers, scale them in the range 0-255, and then feed them to the RGB function (also in the Help files) to produce the 24-bit color pattern. THEN you want to use a DCount function on your color field in this table to verify that no other record has a matching color. If you hit a matching color, repeat the random number process until the DCount is 0.

Now, if your issue is more than this - such as whether any two colors will differ by only one bit in one of the three color intensity codes - you complicate the issue and start to need to consider mapping the numbers.

But in the abstract, what I said above is the way I would do it.
 
OK Some more Information and some more Complexity

Products have the following in Characteristics: Category, SubCategory, SubSubCategory,Brand.

SO it would be best that if products are in a certain Category their colors are as far away from each other, except if they are from the same brand.

Afterwards I want to generate a Calendar Report (I've found an example here on the forum - see attachment and choose Crew Rotation Schedule)
In the example every vessel has a color and is scheduled during a certain month. In my report the vessels will be products and the colored bars will be promotional periods.

The problem is that I started with input and know I want to create some output, and i can't create a color field manually because there are to many products in the database.

Thx

Maybe thinks are a bit more clear now.
 

Attachments

Because of my location, I cannot download your file. Our network folks restrict zip files from public sites.

If you are going to display this, you are going to complicate matters. You have now introduced CONSIDERABLE complexity because you only have a limited number of colors you will be able to distinguish by eye.

First, how many colors will your display card accept? Some older (cheaper) units can only got to 256 or 64K colors. Both are a LOT less than the 16 million that are possible using RGB function.

Second, how many different colors will your eye see in your particular office environment (skylight vs. incandescent lights vs. fluorescent lights - just one factor; monitor quality is another) and display settings? I know this: Just because my display is technically capable of accepting 16 million colors doesn't mean I can tell the difference between them all. Not only is the adapter an issue,

NOW you are getting into some really complex issues. I have no clue as to how you would attack this problem.
 
If you think it's to difficult, it probably is. Maybe I can simplify things by saying products belonging to a certain brand get the same color and I limit myself to lets say 30 colors as a whole.
I only want to create a report which is very visual and that can be put into a Powerpoint Presentation, so I have to avoid there are 30 different kind of red on the report. But It will probably be a manual job.
Doc_Man, if you can download the file at home, it will become more clear.
I have to go now.

Thx,
Agamemnon
 
Hi,

I'm trying to understand how the calendar report in attachment works.
If you open the database Calendar there is some code for the Report_rptRotation. Now I'm wondering where the object
"boxTimeLine" comes from. I've started a new project and want to use this object but I can't find it.

Anybody?
Agamemnon
 

Users who are viewing this thread

Back
Top Bottom