dbTalk Databases Forums  

Changing background color - function script

comp.databases.filemaker comp.databases.filemaker


Discuss Changing background color - function script in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Buckbuck
 
Posts: n/a

Default Changing background color - function script - 05-09-2010 , 12:40 PM






FM8.5

I am creating a Ledger. My business has several bank accounts; Cdn$
(Debit & Credit), US$ (Debit & Credit), Visa card (Debit & Credit). I
am trying to effect the appearance of my Ledger so that I can
recognize certain accounts by the background color. The list would
appear as a series of color strips based on which of these accounts
record x in the list shows content.

I know how to create a field that will change color based on a value
list using a global and container field;
Case ( Category = "Expense"; gExpenseColor)

I do not know how to create a function that describes the following;

Ex.
When Cdn Dollar Account (debit or Credit) has a value (ie: there is a
number or entry in the CdnDollarAcccount field) the result
isgCdnDollarBackgroundColor

or something like

Case ( CdnDollarAcct = "(has content)"; gCdnDollarAcctBackgroundColor)

Can you help?

Thanks
Matthew

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: Changing background color - function script - 05-09-2010 , 04:00 PM






"Buckbuck" <buck.matthew74 (AT) yahoo (DOT) com> wrote

Quote:
FM8.5

I am creating a Ledger. My business has several bank accounts; Cdn$
(Debit & Credit), US$ (Debit & Credit), Visa card (Debit & Credit). I
am trying to effect the appearance of my Ledger so that I can
recognize certain accounts by the background color. The list would
appear as a series of color strips based on which of these accounts
record x in the list shows content.

I know how to create a field that will change color based on a value
list using a global and container field;
Case ( Category = "Expense"; gExpenseColor)

I do not know how to create a function that describes the following;

Ex.
When Cdn Dollar Account (debit or Credit) has a value (ie: there is a
number or entry in the CdnDollarAcccount field) the result
isgCdnDollarBackgroundColor

or something like

Case ( CdnDollarAcct = "(has content)"; gCdnDollarAcctBackgroundColor)

Can you help?
You've basically done it, but instead of "has content" you need to test if
the field "is not empty". It's also probably best to put in a value for when
the test fails (i.e. when the field doesn't have content).
e.g.
Case ( CdnDollarAcct <> ""; gCdnDollarAcctBackgroundColor; "")

When CdnDollarAcct is not empty, then use
gCdnDollarAcctBackgroundColor
otherwise leave empty.

the <> can be replaced by the proper 'not equal' symbol (the = with a
vertical bar through it). That symbol doesn't display properly in all
newsreaders, but either version will work in FileMaker Pro.

Or you can use the IsEmpty function to get the same result.
e.g.
Case ( Not(IsEmpty(CdnDollarAcct)); gCdnDollarAcctBackgroundColor;
"")

When CdnDollarAcct is not empty, then use
gCdnDollarAcctBackgroundColor
otherwise leave empty.

You can also turn the test around and have the Case statement test to see if
the field is empty instead.
e.g.
Case ( IsEmpty(CdnDollarAcct); ""; gCdnDollarAcctBackgroundColor

When CdnDollarAcct IS empty, then leave empty, otherwise use
gCdnDollarAcctBackgroundColor.


All of the above Case statements will assume a CdnDollarAcct value of 0 is a
valid data value and use the gCdnDollarAcctBackgroundColor value. If values
of 0 are not valid, then you'll need to get a little more complicated.
e.g.
Case ( CdnDollarAcct > 0; gCdnDollarAcctBackgroundColor;
CdnDollarAcct < 0; gCdnDollarAcctBackgroundColor;
"")

When CdnDollarAcct is more than 0, then use
gCdnDollarAcctBackgroundColor,
or when CdnDollarAcct is less than 0, then use
gCdnDollarAcctBackgroundColor,
otherwise leave empty.


Helpfull Harry )

Reply With Quote
  #3  
Old   
Ursus
 
Posts: n/a

Default Re: Changing background color - function script - 05-10-2010 , 02:43 AM



Quote:
When CdnDollarAcct is more than 0, then use
gCdnDollarAcctBackgroundColor,
or when CdnDollarAcct is less than 0, then use
gCdnDollarAcctBackgroundColor,
otherwise leave empty.


Helpfull Harry )



Or (v10 and up) go with the conditional formatting for the fields you want.
In which case you probably don't need to store the colours in a global and
you don't need extra calc fields for the result.

The calc for the conditional format would be something like:
notisempty(self). Or self>0 if you want that.

--
Keep well / Hou je goed

Ursus

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.