Jump to content

Count field - grateful for your advice


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

Recommended Posts

Hi

I have a database of 10,000 records. One of the fields is 'Profession', validated against a Value List of 30 professions. I want to create a field which automatically counts up how many records there are for each profession, and displays the number on each record. So it would show Joe Bloggs as Surveyor and then say '40' if there were 39 other surveyors.

I'm a beginner at this, but should I be setting up a calculation field which uses the Count function, and if so, can anyone advise how I should define it, assuming the Profession field is called 'Profession'.

Thanks.

Philip

Link to comment
Share on other sites

Hi Queue

Thanks for the advice. I've created the self-relationship, and created a new calculation field, but I'm not sure what the (relationshiop::id) is. If I haven;t exhausted your patience, can you explain?

Thanks.

Philip

Link to comment
Share on other sites

Philip, relationship::id translates to the related id or serial number field (unique identifier) based on the self-relationship we've just created. When you create the calculation, enter Count(, then select the self-relationship from the menu above the field list, and the serial number field from the resulting list. Then enter the closing parenthesis.

FMFan, formatting a field as a radio button or checkbox is merely a visual aide. It doesn't change the content of the field. If you have field with "yes" and "no" radio buttons, the field contains either yes or no. So a test for the value would be If [field = "yes"] or If [field = "no"]. If you are using checkboxes or expecting that more than one radio button option will be selected, use If [PatternCount( field, "yes" )], et al.

Link to comment
Share on other sites

Did not work Queue. Actually, I have a checkbox that is either selected or not selected. I want to be able to determine whether the checkbox is selected or not by writing a script that says if check then do this else do this. Any suggestions?

Link to comment
Share on other sites

If table1::new is your field formatted as a radio button and "X" is the option for the field's value list, then If [table1::new = "X"] should work just fine.

Put the field on your layout again, but leave it formatted as an edit box. If "X" is what you see in the field, then it is equal to "X".

Link to comment
Share on other sites

Hey Queue, you're getting your workout today!! smile.gif

FMfan, do you have a radio button or checkbox - you've contradicted yourself here and it makes a difference. The 'X' in a checkbox is just FMs way of tell you it's selected - same with the dot in a radio button. That is NOT what is actually inserted into the field. You need to identify the field contents.

whether a radio button is selected or not

Regardless whether radio or checkbox however, if all you want to know is whether that field has been selected at all, just use IsEmpty() for your test.

If [not IsEmpty(Table1::New)] ... do this, else do this.

As Queue indicated, you need to 1) Look at your Value List and determine what the 'clicked' value will enter. 2) Place your field as 'edit box' field on your layout and make it about 3 rows high to see what all it contains. Why 3 rows? Because sometimes by accident it can contain more than one line and 3) be a bit more precise in your descriptions so we can assist you better.

It's just like talking to a physician. Telling him 'it hurts' doesn't give him enough to diagnose properly. If you want accurate assistance, you need to provide accurate answers. We all want to help you. So help us do that, okay? smile.gif

If you only want to know if your radio or checkbox is selected, the above calculation should work for you. If you want to Omit only if the contents equals something specific, then you need to identify your field contents.

It also appears that the field contents come from a related file/table? If so, it will only display the first matching record from the relationship if it's a regular field on your layout. You may have something else wonky. But I would bet you have a number in that 'checkbox' a one (1). And your Value List only has a 1 in it (if that field is number). That's usually how using a checkbox toggle works.

Link to comment
Share on other sites

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