Advertisement

03.26.2008 at 05:02PM PDT, ID: 23272576
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

procedure to set dynamic backcolor for 1 column
Tags: microsoft, vfp, 8.0
I want to set the backcolor for 1 column to a different color for each different day in a grid.
I am having trouble with nested iff. I saw one suggestion to use a procedure to set the backcoloe.
this is my code, I get no color no matter what the day..day is a number 1 to 7
thisform.Grid1.Columns(5).DynamicbackColor     =   "IIF(day=7, RGB(255,204,255),IIF(day=1, RGB(204,255,153),IIF(day=2, RGB(255,255,255),IIF(day=3, RGB(255,255,102),RGB(204,204,255)))))")
Thanks Jerry
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: quicklikeafox
Solution Provided By: ramrom
Participating Experts: 2
Solution Grade: A
Views: 4
Translate:
Loading Advertisement...
03.26.2008 at 05:22PM PDT, ID: 21217684

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 05:24PM PDT, ID: 21217692

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 05:47PM PDT, ID: 21217788

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 05:53PM PDT, ID: 21217807

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:29PM PDT, ID: 21217899

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:36PM PDT, ID: 21217923

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:54PM PDT, ID: 21217981

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 07:10PM PDT, ID: 21218028

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 07:29PM PDT, ID: 21218076

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 07:39PM PDT, ID: 21218110

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 09:24AM PDT, ID: 21223141

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.26.2008 at 05:22PM PDT, ID: 21217684
I was missing a )
this works
thisform.Grid1.Columns(5).DynamicbackColor     = ;
"IIF(day=1, RGB(204,255,153),;
IIF(day=2, RGB(50,255,255),;
IIF(day=3, RGB(255,255,175),;
IIF(day=4, RGB(255,200,200),;
IIF(day=5, RGB(174,200,255),;
IIF(day=6, RGB(255,102,200),;
IIF(day=7, RGB(255,204,255),;
RGB(255,255,255))))))))"
 
03.26.2008 at 05:24PM PDT, ID: 21217692
I would still like to see some code to set the backcolor with a procedure.
Thanks Jerry
 
03.26.2008 at 05:47PM PDT, ID: 21217788

Rank: Guru

I don't understand "I would still like to see some code to set the backcolor with a procedure." How would that be different from your code above?

You could also use ICASE() and not worry about counting parentheses.
1:
2:
3:
4:
5:
6:
7:
8:
9:
thisform.Grid1.Columns(5).DynamicbackColor = "ICASE( ;
day=1, RGB(204,255,153), ;
day=2, RGB( 50,255,255), ;
day=3, RGB(255,255,175), ;
day=4, RGB(255,200,200), ;
day=5, RGB(174,200,255), ;
day=6, RGB(255,102,200), ;
day=7, RGB(255,204,255), ;
       RGB(255,255,255))"
Open in New Window
 
03.26.2008 at 05:53PM PDT, ID: 21217807
some where I read that you could set the backcolor with a external fuction, I was just curios what that code would look like.
Thanks Jerry
 
03.26.2008 at 06:29PM PDT, ID: 21217899

Rank: Guru

In order to set this property one must assign to thisform.Grid1.Columns(5).DynamicbackColor.

If the code is not in a form method then one must replace thisform with another reference to the form.

If for example you issued DOFORM test you can then write test.Grid1.Columns(5).DynamicbackColor = etc...

I sure hope that is what you want otherwise I don't understand the question.
 
03.26.2008 at 06:36PM PDT, ID: 21217923
I would like to see the code simular to
thisform.Grid1.Columns(5).DynamicbackColor=some_procedure()
Can I do this, do I have to have " marks
are they to be embeded in some_procedure
do I have to use &some_procedure()

Thanks Jerry
 
03.26.2008 at 06:54PM PDT, ID: 21217981

Rank: Genius

You can simply add a method of your own to the form that contains the grid.

Put your code in the method that determines the color.  If you have a lot of conditions as I have had in one app, you can simply create a DO CASE construct and evaluate some field content to determine the color you want.  That color then gets returned from the method to your DynamicBackColor assignment.

With a custom mjethod in a form with a grid called "RecordColor":

thisform.Grid1.Columns(5).DynamicbackColor=RecordColor()
 
03.26.2008 at 07:10PM PDT, ID: 21218028

Rank: Genius

If you had a custom method named recordcolor and you had a field in the controlsource of the grid that had a field named "OrdStat", you could tailor your grid colors based on the values assigned to OrdStat for each record/row:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
** custom method code for recordcolor()-- returns a single color
DO CASE
	CASE INLIST(ordstat, "SHIPPED", "BILLED")
		RETURN RGB(255, 255, 255)		&& White
	CASE ordstat="BACKORDERED"
		RETURN RGB(255, 0, 0)		&& Red
	CASE ordstat="Processing"
		RETURN RGB(255, 255, 0)		&& Yellow
	CASE ordstat="Awaiting Processing"
		RETURN RGB(0, 255, 255)		&& Lt. Blue
	CASE ordstat="WAITING FOR PARTS"
		RETURN RGB(255, 0, 255)		&& Purple
	OTHERWISE
		RETURN RGB(255, 255, 255)		&& White
ENDCASE
Open in New Window
 
03.26.2008 at 07:29PM PDT, ID: 21218076
I tried somthing like that but called it with  
thisform.Grid1.Columns(5).DynamicbackColor=thisform.IsWhatDayr()
I put this in the init of the column
an the method in the form
I willl try it without the thisform.
Thnaks Jerry
 
03.26.2008 at 07:39PM PDT, ID: 21218110

Rank: Genius

As is the way with FoxPro, there are a number of ways to attack the same thing in a lot of scenarios.  But you get the general idea.
 
03.27.2008 at 09:24AM PDT, ID: 21223141

Rank: Guru

thisform.Grid1.Columns(5).DynamicbackColor=thisform.IsWhatDayr() is correct. Show us the code for IsWhatDayr(). That is where the problem lies.

Consulting help:
Column.DynamicBackColor [= "cExpression"]
cExpression specifies a character expression [that] evaluates at run time to a single color value.

For a simple example say you want the column to change color depending on the sign of a number:
thisform.Grid1.Columns(5).DynamicbackColor="iif(number >= 0, rgb(...), rgb(...))"

You can generate the value any way you want (literal, expression, function, magic, ...). The result must be a character string that can be evaluated at run time.

I take issue with CarlWarner's code.

1 - A form method must be preceded with a form reference (e.g. thisform.RecordColor())

2 - As written RecordColor() is evaluaated once, and returns a number. This is wrong for 2 reasons:
  a - DynamicbackColor requires a string.
  b - The string must be an expression that can be evaluated every time the grid is refreshed.


For what it's worth in regard to future questions:
"I would still like to see some code to set the backcolor with a procedure." was too vague, ambiguous, ???
"thisform.Grid1.Columns(5).DynamicbackColor=some_procedure()" was perfect!

Please think thru questions as though you were one of us. Help us "get it" the first time.
Accepted Solution
 
 
03.27.2008 at 10:01AM PDT, ID: 21223564
Thanks. Since I said a LOT would you tell me how it helped or what your final solution was?
 
 
03.27.2008 at 10:16AM PDT, ID: 21223740
I'm sorry, I have not used form in a long time and went to fast and did not take opportunity to reply, I just  realized what my problem was from your explination. I was not returning a string and did not get a  error  but also did not get any colors. I wanted to have the syntax for a procedure in my box.
I used the nested iif and that also works.
I did not understand the purpose of the quote marks around the "iif(number >= 0, rgb(...), rgb(...))"
I guess anything resulting from the iif is made a string.
I will certainly try to explain my problems more completely in the future
Thanks Jerry
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628