Jump to content

Portal row background based on calculation/script


David Holmberg
 Share

This topic is 6532 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello!

I've got a problem and hope that someone can solve it for me.

I've have on file with undefined number of records. Each record contains two fields. One field is a text field and contains different kinds of training intensities (A1,A2,A3 etc). The other field is a container field containing a colarbar.

Then I've a second file with a greater number of fields (maybe 15). One of these fields uses a valuelist based on the values from the text field in the first file.

Finaly I've a third file wich is a calender. It contains portals which through a relationship will show values from the second file. This file works fine overall but I'm trying to use the colorbars from file one as background in the portalrows in file three (taking the colorpict from the record in file one with the same intensity value as the one shown in the relationfile from file two).

I think I've made it a litte bit harder than it should be?? Is there a other way? It would be a bonus if each user could define for him-/herself which color the wanted to representing the different intensities.

Hope that you understand wthat I'm trying to do.

Link to comment
Share on other sites

You can make it so a single global container has the color to use.

I'd use globals for the original color containers, e.g. g.BG.Color.Blue, g.BG.Color.Red. The user could specify their color choice using another global, g.MyBG.ColorText, with a popup menu having a value list of colors. Then a calculation could return their preferred color:

gc.MyBG.Color=

Case (

g.MyBG.ColorText = "Blue", g.BG.Color.Blue,

g.MyBG.ColorText = "Red", g.BG.Color.Red,

...

)

If you name the colors in the Value List to exactly match the field names, you could use a GetField instead of the Case:

gc.MyBG.Color=GetField("g.BG.Color." & g.MyBG.ColorText)

Don't forget: for each of these background fields, format "Graphic..." to Reduce or Enlarge image and uncheck Maintain original proportions.

Link to comment
Share on other sites

Currently all records in the portal take the color that matches with the first record.

I've set red color for "AI" and blue for "AII". The portal displays two records, record one have the intensity of "AI" and record two have "AII". If I do a sort that places record one first both records get the BG color red and if record two comes first both get the BG color blue.

Link to comment
Share on other sites

Hi,

A small attachment could help here, but as it seems the colorfil in portal is always the same as the one from the "first" record, then I'd suspect the calculation you're using doesn't use the same relationship than the portal.

Link to comment
Share on other sites

First I want to thank CyborgSam and Ugo DI Luca for helping me, it means a lot!!

The calculation uses the same relationship as the portal. Would be interesting to see one of thoose attachments. What do people normally do to get this to work, I mean, there ain't anusual with calenders were different appointment types are represented with different colors and in some of them the user has to be able to choose the colors by himself.

Link to comment
Share on other sites

Define an relationship from your second file to your first file (Supposing the text field in first file is named "intensitiesField" and the valueList field in second file is named "intensitiesList", define an relationship intensitiesRel:intensitiesList--> intensitiesField)

Now in your second file define an unstored calc filed of type container as:

intensitiyColor=intensitiesRel::colorBarField

Put intensitiyColor as background field for your portal.

That's it

Dj

Link to comment
Share on other sites

This topic is 6532 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.