Jump to content
Server Maintenance This Week. ×

Global field issue


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

Recommended Posts

I have a field "dotfield" that changes from a white dot (invisible on the layout) to a black dot when the record is selected. I use this field as a graphical way to show which record is selected - then a user can pick a serious of buttons for what they want to do with that record.

I implemented this awhile ago and it is not the most elegant solution. However I think it is important for me to understand why it doesn't work, even though I will probably scratch this functionality in the future.

The fields I use for this are

gWhiteDot = global field that has auto enter data set to TextColor ( TextSize ( TextFont ( "l" ; "Wingdings" ) ; 18 ) ; RGB ( 255 ; 255 ; 255 ) )

**This produces a white dot

gSelectedID = globla field, holds the currently selected records ID# (set via script)

DotField = calculation

If ( gSelectedID = ShowID ; TextColor ( gWhiteDot ; RGB ( 0 ; 0 ; 0 ) ) ; gWhiteDot )

I have a list view layout that displays records and includes the DotField as the first field in the row of data. On the layout I have attached a script to the Dotfield :P

Set Field [Table::gSelectedID; Table::currentrecordID]

When you click on the Dotfield in a certain row...that field changes from white (invisible) to black to show the record is selected.

This database is shared on a server in a multiuser environment. It works great on my computer (where the solution was created) but the black dot does not appear next to the current record on any other desktop.

I assume it has something to do with the global fields but I have made sure to set the gWhiteDot field in a single user environment. I don't understand how the other global gSelectedID would be affected in a multiuser environment as it is set by a script each time.

Probably something simple I am overlooking but I just don't get it! Thanks!

Edited by Guest
Link to comment
Share on other sites

Make sure that the calculation field is unstored.

A common way of doing this, without having to rely on special fonts being installed, is to use a calculated container field to display one of two different graphic elements (such as a dot as in your example) like this:

GetRepetition ( gGraphic ; 1+(Get ( RecordID ) = gSelectedID) )

In this example, gGraphic is a repeating container field that contains a two different graphic elements.

Link to comment
Share on other sites

I really appreciate your responses. The calculation is unstored - it works as expected on my computer. Also I did check to make sure the white do and black dot show up correctly on the other machines (they have the font installed). The layout that I'm using is a list view form. I temporarily put all of the fields in questions on the footer part of the layout and checked that each field was correctly populating on the other machines. The test fields populate correctly on the other machines - the black dot shows up in the dot field when the gSelectedID matches the current RecordID, it just doesn't show up in the list part of the layout.

I appreciate the more elegant solution offered by Bob and will probably switch to this in the future. I still would like to know why my current setup isn't working for future reference as well.

Thank you to anyone who offers suggestions!

Link to comment
Share on other sites

Also, make sure that your global field really is defined to be global. I don't know how many times I've meant to create a global field and forgot to actually make it global.

As for why it works on the host but not the client machines, I don't know. Could it have something to do with the script that you use to set the global field?

Link to comment
Share on other sites

Here is what I THINK is happening (at least the theory is holding in this demo) ...

Your DotField calc is: If ( gSelectedID = UniqueID ; TextColor ( gWhiteDot ; RGB ( 0 ; 0 ; 0 ) ) ; gWhiteDot )

It is based upon there always being a value in gWhiteDot. But ... gWhiteDot is an auto-enter calculation on a standard global field? It will not persist on clients. So what happens is that it loses its value and your DotField can't calculate because both true and false are based upon an empty field. As a User adds a record, your dot will reappear because the auto-enter on the global fires (populating every record since it's global) and thus producing the black dot.

Here's an example in action. Remove the text from gWhiteDot (as if you were a Client closing down). Change the gSelectedID. Now add a new record - yours will start working again.

Try changing your gWhiteDot to a CALCULATION global - see the two new fields on the right.

WhiteDot.zip

Link to comment
Share on other sites

  • 2 weeks later...

This topic is 6579 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.