Jump to content

Value lists in calculation fields


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

Recommended Posts

Hi,

I have a calculation that starts by getting an "id_user" value from the table "checkins". Instead of returning this id number, I would like to use it ("id_user") to look up a matching "user_name" in table "users".

Is this possible?

Right now I solve it by the common practice of creating a popup menu where the first value is the id and the second the name. I then only show the second field.

However, I was curious if I could somehow do all of it in the calculation field so I could insert the name via a merge field and not having to use a popup menu.

Thanks,

Phillip

Link to comment
Share on other sites

Right now I solve it by the common practice of creating a popup menu where the first value is the id and the second the name. I then only show the second field.

However, I was curious if I could somehow do all of it in the calculation field so I could insert the name via a merge field and not having to use a popup menu.

If you have a relationship with the "users" table, based on matching the selected "id_user" value, you can simply place the "user_name" field from the "users" table on the layout, no calculation field required.

Link to comment
Share on other sites

Is it possible to access a value list in a calculation field?

Yes, it is possible through the ValueListItems() function. However, only the first field can be accessed that way. In order to calculate the value of the corresponding second field, you would have to first define another value list, using values from the "user_name" field and sorted by the "id_user" field, and then use a calculation like this one: http://www.briandunning.com/cf/908

Or you could just place another instance of the local "id_user" field on the layout, format it as pop-up menu and disallow entry.

Yet another option is to have a calculation field = users::user_name and set it to evaluate from the context of a TO that is related to the users table.

Edited by comment
Link to comment
Share on other sites

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