Jump to content
  • 0

Hide Form Field Based On Number of Table Records


RJOHNSON

Question

How would I go about hiding a specific field on a form after the total number of table records are equal to a specific number of entries?
For example: If there are 200 data/table records, I need a specific field from the form associated with submitting new entries into that table to automatically be hidden (e.g., Form field "A" is no longer an option and automatically hides its self after 200 entries have been recorded).

Is there a Javascript I can place in the submission form Footer that will execute this? Any assistance would be appreciated.

Thanks

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @RJOHNSON,

There is a way to do this using standard features.

Here are the steps:

1. Add an Autonumber field to your table.

2. In the submission form, add a Virtual field. Make sure you create this field under a separate Section.

3. Set its form element to 'Calculated Value'.

4. Enter a formula for the field:

select top 1 fieldname from tablename order by id desc

Replace fieldname and tablename with the respectives names from your table.

5. Click on Rules and create two rules as below:

RULE 1: Under criteria, select the virtual field and operator as 'Is Not Blank'. Under Actions, select Action as 'Hide' and choose the section this Virtual field falls under. This will make sure that the Virtual field value is hidden.

RULE 2: Under criteria, select the virtual field and operator as 'Greater than or Equal', and Value as 200 or your desired number. Under Actions, select Action as 'Disable' or 'Hide' as per your requirement and choose the field name that you want to disable. 

The only downside of this idea is that the virtual number spins while it is still calculating  the value. But after that everything works as expected.

Hope this helps.

Regards,                              

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...