How to display the next milestone date in a view

By: John Lenehan | Asked: 11/03/2022
ForumsCategory: How-toHow to display the next milestone date in a view
John Lenehan asked 2 years ago

Hi

Could you let me know if I\'m missing a simple solution, or do I need to write a custom shortcode?

I created a form with 3 Date fields. Each field represents the date of a milestone in a project.

For example:

Field 1 title: Milestone 1
Field 1 content: 01 Jan 2023

Field 2 title: Milestone 2
Field 2 content: 01 Feb 2023

Field 3 title: Milestone 3
Field 3 content: 01 Mar 2023

I want to create a view for the above form that displays the next milestone date.

If a user looked at the view today, they would see: Milestone 1 - 01 Jan 2023
If a user looked at the view after 01 Jan 2023, they see: Milestone 2 - 01 Feb 2023
If a user looked at the view after 01 Feb 2023, they see: Milestone 3 - 01 Mar 2023

I have tried to achieve the above using conditional statements in a view; for example:
[if x greater_than_or_equal_to=\"10\"]Add content here[/if x]

However, conditional statements require a string, and I need to use a shortcode, for example:
[if x greater_than_or_equal_to=\"[161]\"] which does not work. I have also tried to use the frm-condition shortcode however its conditions are too basic (equals, not_equal, greater_than, less_than, like), and it does not allow multiple conditions.
I\'m looking for something like this:

I know it\'s easy to sort entries, but I want to sort fields in an entry! Am I pushing formidable forms too far, or is there an easy solution I am overlooking?

Any guidance is appreciated

Thanks

John            

2 Answers
Bobby Clapp answered 2 years ago
John Lenehan replied 2 years ago

Thank you for your suggestion Bobby

Filtering is used to display a filtered set of entry records.

I don't think it can be used to show certain field values within an entry.

Bobby Clapp replied 2 years ago

Got ya. With the conditional statements, try to compare the output of your 2 date fields and make sure they match up. Maybe place them outside of if statements. You might need to add format to the field id shortcode:

[x format="m/d/Y"]

John Lenehan replied 2 years ago

<p><p>Conditionals require a string, for example:[if 191 less_than_or_equal_to="2023-01-11"] Display date [191][/if 191]</p><p>This will work.</p><p>However, what I need is something like this:</p><p>[if 191 less_than_or_equal_to="[191]"] Display date [/if 191]</p><p>If I use a string it means a I have to make a new view for every entry.</p><p> </p></p>

Bobby Clapp replied 2 years ago

The less_than_or_equal_to="[191]"] should be populating as 2023-01-11 (191 that is) if that is a value for the entry you are working with and it has the proper formatting defined.

John Lenehan replied 2 years ago

Hi Bobby

You can't use a shortcode in a conditional statement (I think). For example, the shortcode below is [192]:

[if 191 less_than_or_equal_to="[192]"] Show content [/if 191]

It is not mentioned anywhere here: https://formidableforms.com/knowledgebase/conditionals/

You can only use a string:

[if 191 less_than_or_equal_to="8 November 2022"] Show content [/if 233]

I hope I am overlooking something here.

Thanks

John

John Lenehan answered 2 years ago
Hi I tried this method. However, the conditional options are too basic. This shortcode only allows 'equals, not_equal, greater_than, less_than, like'. It would at least need 'greater_than_or_equal_to' or 'less_than_or_equal_to'. To make my example work, it would also need to support two conditionals, for example: [frm-condition source=frm-field-value field_id=391 entry=[id] greater_than_or_equal_to="[191]" less_than="[192]"] Show content [/frm-condition] It does not support two conditionals. John    
Bobby Clapp replied 2 years ago

At this point you will have to write custom code. You should however reach out to the Formidable team and inquire why "than_or_equal" isn't available in the "frm-condition" shortcode. Additionally, most of the other shortcode that works with these queries allow you to use each parameter type once (example: less_than_or_equal, but also greater_than_or_equal in the same statement, but not less_than_or_equal and then less_than_or_equal again in the same statement). They should provide some clarity on that and ideally update code across the table for consistency. That's not my call though.

John Lenehan replied 2 years ago

I will follow up with the Formidable team about this.
Thank you, Bobby, for your help.
I appreciate it.

Bobby Clapp replied 2 years ago

Sure thing. Glad to try and help where I can. Take care.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right