Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Dynamic Portal Filtering--account for no records (showing)


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

Recommended Posts

Posted

Hello Forum:

I portion of my database is using the "Dynamically Filtering Filtered Portals" by Sara Severson found on the Soliant Consulting website (for some reason I can't paste a link).

What I was hoping to accomplish was as the user (me only) was typing, the list filters down.  This works fine.  But if I type to the point where the portal goes blank (no records match), then I would like to allow the user the option of creating a new record. 

I attached the sample file.  For simplicity's sake, I stripped out all parts of the DB except that related to this topic.

U/N admin

P/W 1234

The script affecting the portal filtering is at the bottom of Manage Scripts, and the portion I was hoping for some guidance is commented out at the bottom.

Any help or recommendations are always greatly appreciated.

Thanks

Steve

 

As soon as I figure out how to upload the file, I will update.  Currently I get a message saying "Error You aren't permitted to upload this kind of file"  which is of course a FM file.

Sample1.zip

Posted

The script affecting the portal filtering is at the bottom of Manage Scripts, and the portion I was hoping for some guidance is commented out at the bottom.

 

Steve –

 

you haven't really said what your issue is …

 

If it is detecting at what point the filter term doesn't yield any results (i.e. the portal is empty), I suggest the usual “count rows in a filtered portal” trick:

 

Create a summary count field in the target table, or just an unstored calculation field defined as Get ( FoundCount ); put that into a one-row portal with the same filter calculation, give it an object name, and use 

If [ not GetLayoutObjectAttribute ( "theObjectName" ; "content" ) // i.e. = 0 ]
  # Show Custom Dialog etc.
End If

You can place that portal outside of the layout area.

 

btw, since you already have a finely targeted refresh mechanism in place, you can do without the rather blunt instrument of Refresh Window [ Flush … ].

Posted

Thanks as always Eos, many fine recommendations to try.

I did take the 'blunt instrument' out in my working database.

The 'issue' isn't really an issue per se.  When typing leaves the portal blank (no record, so I'll need to add a new one) I wanted something to trigger a custom dialog with...."No products. Create a new Product record?"..kinda thing.  I will try your suggestions.  The 'count rows in a filtered portal' trick was what I started with, but didn't get it working, because I didn't know the 'trick'. 

However the only problem I see if/when I do get it working is that a simple typo will be annoying with a pop up Show Dialog.  Maybe I'm better off just putting a button to add a new Product record and be done with it.

But I still will try your suggestions first, especially for the learning experience. :grad:

Thanks again for your time.

Steve

Posted

However the only problem I see if/when I do get it working is that a simple typo will be annoying with a pop up Show Dialog

 

One man's typo is another man's multi-million dollar brand name … but you're right, that kind of attention will get old pretty quickly.

 

The 'count rows in a filtered portal' trick was what I started with, but didn't get it working, because I didn't know the 'trick'.

 

Interesting … how could you start with it without knowing it …?  :laugh:

 

Anyway, this is the same “trick” that allows you to display a count of portal records; so you may opt to not “hide” the portal, but show it as a “Found records: #” display, regardless of its usage (or not) as “no matches detector”.

Posted

Well I didn't know 'the trick' but I was trying different options with Get(FoundCount) and counting portal rows......but having an idea and guessing didn't work out for me.

Thanks again :)

 

Posted

Note that you don't need a separate portal for this. If one of the fields in the filtered portal will alway have a value, you can test this.

See attached.

 

I am checking for whether the Category field in the portal is empty.

However, since you have set that field to act as a buttons, I had to first ungroup it, give an object name to the field itself, then change it back into a button.

 

SampleMOD.fmp12.zip

  • Like 1
Posted

Wow thanks Bruce. Works perfectly.  I read about GetLayoutObjectAttribute in the help section even after your example but would never figure out how it would work, without your solution

Thanks again for taking the time to help and teach.

 

Steve

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