Jump to content
Sign in to follow this  
stevebanzai

colorizing text in value lists

Recommended Posts

stevebanzai

Is there a way to colorize text within a value list so that I can make the words HOT-(red) Cold-(blue) etc.

 

Or what I really wanted was simply to have a popup list that had 3 different colored chips to denote status...

 

Im in FMP 7

 

Thanks anyone for help

Share this post


Link to post
Share on other sites
AHunter3

Not with a true dropdown value list.

 

If you're willing to go to a bit of trouble, you can fake it, but it's pretty resource-expensive for the rather limited payoff. Requires navigating to another layout (or at least another tab of the same layout), and if the VL is non-static, of writing data to related records to create the illusion of a dropdown value list.

 

Or conceivably there's a plug-in. It's impossible to say what some plug-in or other for sure can't possibly do, although I've never heard of one that does this.

Share this post


Link to post
Share on other sites
stevebanzai

are there any other alternatives to show 3 different colored images or words in one field whether popup, radio button etc?

Share this post


Link to post
Share on other sites
AHunter3

Portal. Or repeating field.

Share this post


Link to post
Share on other sites
stevebanzai
Portal. Or repeating field.

 

would you be kind enough to explain how to set up a repeating field if that in fact is the simplest option?

 

Thanks

Share this post


Link to post
Share on other sites
AHunter3

I advise against using them. I would go with a portal relationship myself.

Share this post


Link to post
Share on other sites
stevebanzai
I advise against using them. I would go with a portal relationship myself.

 

Please explain how to set up a portal relationship, again thanks, you seem to be the only one helping.

 

best,

 

-steve

Share this post


Link to post
Share on other sites
AHunter3

The normal way of using a portal is to connect two tables whereby a handful of records in one table represents sub-elements of a single record in another. An example would be an Invoice which has several Invoice Line Items. Each line item would be an item with a quantity, name, item price, and a calculated extended price; and there might be any number of them on any given invoice. On the invoice itself would be the person or company to which they were sold, the date, the invoice number, the billed status, the paid status, and so on.

 

So to make the relationship, you'd have to have a field or fields that relate to each other; the obvious choice in this example would be invoice number: we'd create an invoice number field for the line items and each line item would be related to the Invoice like so:

 

Invoice::Invoice Number = Invoice Line Items::Invoice Number

 

and you'd check the checkbox to allow record creation on the Invoice Line Items side, so that you could add a new line item simply by typing in the bottom (empty, waiting) portal row. Oh yeah, portal row, you'd use the portal tool to draw a portal to a related table from the Invoice screen, specifying Invoice Line Items as the table to which you want the portal to go; you'd specify how many portal rows to show, specify which fields from Invoice Line Items you want to have showing in each portal row, and there's your portal.

 

 

For your purposes, you'd be using a portal in a mildly non-standard way; you would not be storing actual data in the related table, just the values of a value list. Of course, if your value list already draws upon related data to get its values, you're already home, you've already got your related table. But if your value list is a custom value list (i.e., you manually typed in "apples bananas oranges blueberries" in the Define Value Lists screen), you need a table to serve as PhonyValueList table. And it would have one field to contain the values you want to show up in the phony dropdown (e.g., "apples / bananas / oranges / blueberries").

 

On your regular screen, clicking the field, instead of making a true dropdown value list pop down, would instead perform a script; if you're using a PhonyValueList table, the script would go to any existing related values, delete them, then make a new record for each value in the value list, populating the primary field with the values until all values have a record; while doing so, it would use some kind of logic to assign a color to each record — you could simply decide that the first value is always blue, the next red, the next green, and so forth; or if your values in your value list are somewhat predictable and stable you could use a formula such as Case (PhonyValueList::ValueListItem = "apple", "red" ). You would not actually need to get the value "red" but rather the RGB value of the shade of red you want to use, and using the Text Formatting functions set each ValueListItem to itself but formatted in the chosen color before going on to the next record.

 

This would all be enclosed in a Loop, and when you've come to the end of the values in your value list you're ready to go to the layout that's a replica of your original layout except that where the field normally sits is the field under which is a portal to the values you just generated in your script, with each value on a portal row, color-formatted; and clicking one of them continues your script which sets the main field to the value you clicked on and then returns you to your original layout:

 

If [Count (PhonyValueList::Serial Number)>0]

..Go to Related Records [show only, curr rec only, PhonyValueList, using layout "PhonyValueList"]

..Delete All Records [no dialog]

Else

..Go to Layout [Phony ValueList]

End If

Set Variable [$ValueListItems, "¶" & ValueListItems (Get(FileName), "Name of your Value List Goes Here")] & "¶"

Set Variable [$Pos, 1]

Loop

..Exit Loop If [GetAsNumber ($Pos) > PatternCount ($ValueListItems, "¶")]

..New Record/Request

..Set Variable [$NextItem, Middle ($ValueListItems, Position ($ValueListItems, "¶", 1, $Pos)+1, Position ($ValueListItems, "¶", 1, $Pos+1)-Position ($ValueListItems, "¶", 1, $Pos)-1)]

..Set Field [PhonyValueList::ValueListItem, TextColor ($NextItem; RGB (255; 0; 0))]

..Set Variable [$Pos, $Pos + 1]

End Loop

Go to Layout [Replica of Original w PhonyVLPortal]

Allow User Abort[Off]

Pause [indefinitely]

Set Field [LocalTable::YourField, PhonyValueList::ValueListItem]

Go to Layout [original layout]

 

 

If your value list already draws upon related values to get its values, you don't need to do all that; you only need to store some parameter in each related value that indicates what color the text should appear in, and then create a calc field in that table that results in the original field except text-color formatted:

 

FieldForValueList =

TextColor (FieldYouAreUsing; RGB (MyRGB; Values_For; ThisRecord))

 

 

...and that's what you display in your portal.

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



×
×
  • Create New...

Important Information

Terms of Use