How to conditionally filter entries from another form?

By: Chris Titus | Asked: 10/11/2023
ForumsCategory: How-toHow to conditionally filter entries from another form?
Chris Titus asked 12 months ago

I have two forms:

  1. Form A - I add new listings here
  2. Form B - This is a payment form - purchases of listings in Form A are recorded here

Goal: Create a view that only shows listings with less than 3 purchases. 

I thought this might be possible by using a nested view, but I'm a little lost. 

  • In Form B, I am saving the Entry ID from Form A when a purchase is made.
  • I thought it might be possible by using a conditional statement (e.g. frm-set-get)

Any help / guidance would be greatly appreciated.

Thanks,

Chris

 

--------------------------------------------------------------------------------

 

I figured this out.  In case anyone else has this problem, here's the solution

Place the following into the View for Form A 

[frm-set-get param=purchases][frm-stats id=123 123="[id]" type=count][/frm-set-get]

[frm-condition source=param param=purchases less_than=3]

YOUR CONTENT GOES HERE

[/frm-condition]

The Form A View gets nested into Form B's View

1 Answers
Chris Titus answered 12 months ago

While the above code works for one parameter, if I want to add a second parameter, it doesn't work.

Here's how I tried to add the code:

[frm-set-get param1=purchases1][frm-stats id=123 123="[id]" type=count][/frm-set-get]
[frm-condition source=param1 param1=purchases less_than=3]
[frm-set-get param2=priorpurchases][frm-stats id=345 345="[email]" type=count][/frm-set-get]
[frm-condition source=param2 param2=priorpurchases less_than=1]

YOUR CONTENT GOES HERE

[/frm-condition]
[/frm-condition]

The output on the page contains "[/frm-condition][/frm-condition]" above it.

Chris Titus replied 12 months ago

I've tried many variations of this, such as grouping both [frm-set-get] shortcodes together at the top, followed by the [frm-conditional] statements

Chris Titus replied 12 months ago

@Victor Font - Hi Victor, not sure if you look at threads that are re-opened, but any help you could provide would be greatly appreciated.

Rob LeVineRob LeVine replied 12 months ago

I had similar issues with a view and I *think* it was due to nested frm-condition commands and I think I solved it by removing one of the closing [/frm-condition] statements (which, yes, doesn't make any sense). Honestly, I remember it being a pain in the butt and a lot of trial and error to get around it. I'm not even sure that I fixed all the cases. Some help, huh?

Chris Titus replied 12 months ago

Thanks for your reply Rob. I had noticed the same thing, it removed the closing frm-condition statements that were displayed on screen. Unfortunately, it didn't actually provide the correct functionality. Thanks again!

Chris Titus replied 12 months ago

I've also noticed that using [frm-set-get] along with [frm-conditional] will break any if statements and will display that code on screen as well. I've reported this as a bug. Hopefully, it's something the FF team can fix.

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