Ask a Question related to FileMaker, Design and Development.
-
Trail Runner #1
changing color based on values
I'm trying to change the color of a field based on it's value. For
example we do running races and assign age groups to participants.
AGE GROUP is M20-29 the text is red, M30-39 blue.
Any direction would be appreciated.
Trail Runner Guest
-
Style changes based upon Data Values
I want to change the style of a data presented based upon the value of the data. For example, I if the value is positive I want it to appear black... -
Changing hyperlink template based on data contents
I'm pretty new to all of this, so please forgive me if this is a question you've heard too many times. I'm using VS2003 and vb.net in the... -
Changing row backcolor based on a column value from dataset
I have a asp vb.net webform that uses a dataset to bind from a mssql backend via a stored proc and displays its results in a datagrid. In one of... -
Changing button's URLs based upon text field
I have created a quiz using the Coursebuilder extensions in DWMX, which puts their score in a text field on the page (no data base is used). What I... -
Selecting records based on multiple values
I'm trying to select records which have a FIELD_VALUE = x, y, or z. I've tried several things and I can't seem to make it work correctly. Here is... -
Helpful Harry #2
Re: changing color based on values
In article <cf008b05.0309292054.1470393f@posting.google.com >,
[email]eric@redwoodtrails.com[/email] (Trail Runner) wrote:
> I'm trying to change the color of a field based on it's value. For
> example we do running races and assign age groups to participants.
> AGE GROUP is M20-29 the text is red, M30-39 blue.
>
> Any direction would be appreciated.
The short answer is: You can't.
There's no way to change the colour of the text in a field based on
it's value (except number fields when they're negative).
The long answer depends on which you prefer. You can either SEEM to
change the colour of the text OR simply change the colour of a graphic
in a container field behind the text.
The graphic method is easier in some ways (especially if you have to
change the age group ranges at some stage), but since you wanted to
change the text's colour, one way to make it LOOK like it does this is
to use separate calculated fields for each age group (and within that
Male and Female?), eg.
AgeGroupM2029 = If(Gender = "M" and Age > 19 and Age < 30,
"M20-29", "")
AgeGroupM3039 = If(Gender = "M" and Age > 29 and Age < 40,
"M30-39", "")
etc.
Put these new fields on your layout and format each with the
appropriate text colour and make sure they have a transparent fill
colour. Then stack all fields in a small pile one on top of the other.
Now when the data is entered into the Gender and Age fields the
appropriate AgeGroup field will automatically calculate and the others
will be blank. Since these fields are all in a pile you only see what
looks like one field of the correct colour and text. :o)
BUT there's one problem: it's not possible to easily perform Finds on
the "Age Group" since it's now made up of multiple fields.
There are various ways around this if you need to be able to do such
Finds. Probably the easiest is to create another Age Group calculation
field, eg.
AgeGroup = AgeGroupM2029 & AgeGroupM3039 & ...
Hide this new field at the bottom of the pile (make the previously
lowest field non-transparent). Now format the top field as a button
which runs a script that simply says:
Go To Field [AgeGroup]
Now when anyone clicks onto the Age Group stack of fields, the script
puts them into the combined Age Group field - perfect for performing
Finds and since it's a claculation field they can't make changes if
they click on it when in Browse mode.
This AgeGroup field can also be used for black and white printouts and
other calculations or scripts rather than needing to plow through the
pile of separate ones each time. :o)
Helpful Harry
"Just trying to help whenever I can." :o)
Helpful Harry Guest
-
John Weinshel #3
Re: changing color based on values
Huh? Why not just one calc, returning a container, planted underneath the
data entry field? First, create some global containers and fill them with
rectangles colored appropriately. Then:
Case(
TextToNum(Age Group) > 19 and TextToNum(Age Group) < 30,
Container_Red,
TextToNum(Age Group) > 29 and TextToNum(Age Group) < 40,
Container_Blue
)
....etc. If the pattern persists, you could also use Choose().
If you set that to not allow entry (or backwards-- I always get this one
confused), a cursor placed in the overlying field should work on that field,
for searches and entry. Set the calc propeties to expand and not maintain
proportions.
--
John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Associate Member, Filemaker Solutions Alliance
"Helpful Harry" <helpful_harry@nom.de.plume.com> wrote in message
news:300920031855295725%helpful_harry@nom.de.plume .com...> In article <cf008b05.0309292054.1470393f@posting.google.com >,
> [email]eric@redwoodtrails.com[/email] (Trail Runner) wrote:
>>> > I'm trying to change the color of a field based on it's value. For
> > example we do running races and assign age groups to participants.
> > AGE GROUP is M20-29 the text is red, M30-39 blue.
> >
> > Any direction would be appreciated.
>
> The short answer is: You can't.
>
> There's no way to change the colour of the text in a field based on
> it's value (except number fields when they're negative).
>
>
>
> The long answer depends on which you prefer. You can either SEEM to
> change the colour of the text OR simply change the colour of a graphic
> in a container field behind the text.
>
> The graphic method is easier in some ways (especially if you have to
> change the age group ranges at some stage), but since you wanted to
> change the text's colour, one way to make it LOOK like it does this is
> to use separate calculated fields for each age group (and within that
> Male and Female?), eg.
>
> AgeGroupM2029 = If(Gender = "M" and Age > 19 and Age < 30,
> "M20-29", "")
>
> AgeGroupM3039 = If(Gender = "M" and Age > 29 and Age < 40,
> "M30-39", "")
>
> etc.
>
> Put these new fields on your layout and format each with the
> appropriate text colour and make sure they have a transparent fill
> colour. Then stack all fields in a small pile one on top of the other.
>
> Now when the data is entered into the Gender and Age fields the
> appropriate AgeGroup field will automatically calculate and the others
> will be blank. Since these fields are all in a pile you only see what
> looks like one field of the correct colour and text. :o)
>
>
> BUT there's one problem: it's not possible to easily perform Finds on
> the "Age Group" since it's now made up of multiple fields.
>
> There are various ways around this if you need to be able to do such
> Finds. Probably the easiest is to create another Age Group calculation
> field, eg.
>
> AgeGroup = AgeGroupM2029 & AgeGroupM3039 & ...
>
> Hide this new field at the bottom of the pile (make the previously
> lowest field non-transparent). Now format the top field as a button
> which runs a script that simply says:
>
> Go To Field [AgeGroup]
>
> Now when anyone clicks onto the Age Group stack of fields, the script
> puts them into the combined Age Group field - perfect for performing
> Finds and since it's a claculation field they can't make changes if
> they click on it when in Browse mode.
>
> This AgeGroup field can also be used for black and white printouts and
> other calculations or scripts rather than needing to plow through the
> pile of separate ones each time. :o)
>
>
>
> Helpful Harry
> "Just trying to help whenever I can." :o)
John Weinshel Guest
-
Helpful Harry #4
Re: changing color based on values
In article <vnj0drs3ed8q7a@news.supernews.com>, "John Weinshel"
<john@datagrace.biz> wrote:
Yep, that was the simpler graphic solution I wrote about (and would> Huh? Why not just one calc, returning a container, planted underneath the
> data entry field? First, create some global containers and fill them with
> rectangles colored appropriately. Then:
>
> Case(
> TextToNum(Age Group) > 19 and TextToNum(Age Group) < 30,
> Container_Red,
>
> TextToNum(Age Group) > 29 and TextToNum(Age Group) < 40,
> Container_Blue
> )
>
> ...etc. If the pattern persists, you could also use Choose().
>
> If you set that to not allow entry (or backwards-- I always get this one
> confused), a cursor placed in the overlying field should work on that field,
> for searches and entry. Set the calc propeties to expand and not maintain
> proportions.
normally use myself), but the original person wanted the text to change
colour, so that's the route I went through. :o)
Helpful Harry
"Just trying to help whenever I can." :o)
Helpful Harry Guest
-
FMP Junkie #5
Re: changing color based on values
Concerning the searchability of the original field, here is how I gat
around that ans till have th text change colors...
Fir this example I will use a field where it would say "Yes" or "No".
So, imagine you want the word "Yes" to be red and the "No" to be
black.
2 fields:
ANSWER: Text
YesHighlight: Calc, If(ANSWER = "Yes", ANSWER, "")
Now put a clear-filled field that is 'YesHighlight' over the field
ANSWER on your layout. Make sure you mark the overlay field text
color as red.
Now when you do searches you just check the ANSWER field.
also, Make sure you set the 'YesHighlight' field to not be able to be
entered on the layout.
Hope that helps. I have some layouts which stack 6 or more different
colors of text on a field. It's quite neat looking.
-- FMP Junkie
"Long live FMP!"
FMP Junkie Guest



Reply With Quote

