Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
byrnel0586
Creator
Creator

Text box pop-up on Year selection

Hi,

I am wanting to create a text box that pops up only when a certain Year field is selected. For instance, when any date in 2017 is selected I want the text box to pop-up "Data as of 2016". When any date in 2016 is selected I want the text box to pop-up saying "Data as of 2015", etc. Is there a way to do this in the Show Conditional area in the Layout tab?

Thanks.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Ah, ok, we need to put parentheses around the year calculation:

=If(Only(Year), 'Data as of ' & (Only(Year)-1) )

View solution in original post

8 Replies
swuehl
MVP
MVP

Maybe create a show conditional in your text box like

=GetSelectedCount( DateField) >0

And as expression for the text box itself:

=If(Only(Year(DateField)), 'Data as of ' & Only(Year(DateField))-1)

byrnel0586
Creator
Creator
Author

Thank you for your response.

So in the show conditional I put

=GetSelectedCount(Year) >0 ?

and on the General tab in the 'text' box I put

=If(Only(Year(Year)), 'Data as of ' & Only(Year(Year))-1)  or should I remove one of those Years? Either way I get "-" as my result. I'm also not very familiar with the Only function...

swuehl
MVP
MVP

You don't need to apply Year() function to a year field, this is only useful to calculate year number from a date number field.

=If(Only(Year), 'Data as of ' & Only(Year)-1)

In which field do you make your selections in? And how do your field values look like?

byrnel0586
Creator
Creator
Author

I have a list box for the 'Month' field and a separate list box for the 'Year' field.

swuehl
MVP
MVP

If you make a single Year selection, does the text box work as expected?

byrnel0586
Creator
Creator
Author

It does not. I am getting a - in the box

swuehl
MVP
MVP

Ah, ok, we need to put parentheses around the year calculation:

=If(Only(Year), 'Data as of ' & (Only(Year)-1) )

byrnel0586
Creator
Creator
Author

Awesome, that worked. Thank you!