Jump to content

Global Background for each person


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

Recommended Posts

I thought I was smart. I'm not. I wanted to allow each person to select their background color. I put a Graphics file and set up a field called Background as global container with 10 reps. I set an key field as calculation 1, index on and then put same calc in main file but not indexed.

My plan was to have the user enter a number in a global number field in main file called gBackground - which would match the repetition number. Then a calc container would actually be on the layout. Something like:

Case(not IsEmpty(gBackground, Get Repitition(Graphics::Background, gBackground)

I thought I was smart, trying to use the global number in gBackground to get the associated repetition number in background. Is this making sense? Well, it only displays the first rep.

How do you set something like this up so that each person can have their own color (I mean choose from several colors) for their backgrounds? Any direction would be appreciated. Thanks.

Pete

Link to comment
Share on other sites

You can do it, but there's glitch in your method. You are trying to reference a global repeating field through a relationship. Since globals aren't indexed, you can't do this. And if you could, repeating fields wouln't work properly across a relationship either.

I suggest that you create a regular container field and a numeric index field in the graphics file. Create a record for each background graphic, and put each graphic in the container field, and a unique index number in the index field (you could make it an autoenter serial number). Then simply set up a relationship in the main file with gBackground on the left side, and the index field on the right. Then display the related container field as your background.

Link to comment
Share on other sites

Another option is to put the graphis in the main file as a globalrepeating field with as many reps as there are background options. In the main field the user enters and number or name into a text or number field (BackOpt) and the Background is a calc field:

case(

BackOpt = 1, get rep...,

BackOpt=2, get rep...,

et cetera.

If you want to use the graphis file, then you will need to set up a relationship that can be text fields or calc fields with a simpl number or letter. I use calcs as I am sure they will fill and not be accidentaly overwritten, eg... MFmfCc where the calc is "mf" Do this in both files and make them the relationship for the get repetition calculation.

BackOpt = 1, get repitition(MfRela::gRepField)...

Also, I understand that you can use globals as match fields in both files as long as the fields accessed are also globals. Good luck.

Link to comment
Share on other sites

The problem with global fields is that when used in multi-user, it's very difficult to change their contents permanently. For this reason a "preferences" file is often used: a database with but one record, no global fields.

Link to comment
Share on other sites

Hey, thank you all for the good advice. I thought I was supposed to always use globals for buttons and stuff because, well I found this post on another foruM - Andy Gaunt said, "If the user initiates a find or is left with no records found (either by manually omitting records or from coming out of a script improperly)...those graphics will temporarily disappear on their screen. This can make users very nervous and they get click happy."

He was talking about problems when using regular containers in a graphics database instead of globals. I didn't want to risk the background color disappearing. And I also thought I'd use this file for buttons and stuff. And if the buttons disappear it'd upset my guys!

I also thought globals could be accessed from any file but I guess I'm wrong. Maybe the relationship shouldn't be a global on the right but a regular calculation of 1. Then the global would be available to be passed, right? I thought globals worked even if the relationship is invalid. Unfortunately, I'm beginning to pick stuff up but not enough to put it together into logical thought. crazy.gif

I don't want to put grahics in each file if I can help it. I want to change the color selection from one file that the owner can do. Plus I'm lazy, I admit. I also heard its more efficient because the 'container would only be stored once' by Cobalt Sky in that same post. Confusing stuff.

I'm trying not to ask unless I get stuck. Well, I'm going to play with your ideas but I would have preferred globals, I thought. This is networked. I know globals are 'local to each user' but can't they also be shared? Yeah, I'll dump the repeition idea. I don't know what I was thinking! Trying to be clever and include the number selected into the rep spot. tongue.gif

Pete

Link to comment
Share on other sites

Repeating globals are good for storing graphics if they are in the same file where you want to display them, but not when they are in a different file. Even though globals aren't indexed you can access them from another file via a relationship, but you can't get the repeating values through a relationship.

Link to comment
Share on other sites

This topic is 7356 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
×
×
  • Create New...

Important Information

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