Jump to content
Sign in to follow this  
bruceiow

filtering records on a layout

Recommended Posts

Hi Guys,

 

I'm sure this must be fairly simple, but I am a FM noob. I have a layout which includes a date field and a portal of related records. What I would like to do is have two date pickers in the header of my layout - one for a FROM date and one for a TO date. I would like to then only show records that fall between those two dates. 

 

How would that be possible please?

 

Share this post


Link to post
Share on other sites

1. Make sure that your date picker fields are global fields.

 

2.  Make the relationship for the portal

 

YourTable::FromDate ≤ RelatedTable::Date

YourTable::ToDate ≥ RelatedTable::Date

Share this post


Link to post
Share on other sites

doughemi provided you a solution that would filter the portal (child) rows via the relationship.

You could also set the portal to filter the child rows based on the contents of the globals that doughemi suggested.

 

What is NOT clear from your posting is what data you want to isolate and where the data is located.

if you want to isolate the parents (non portal records) based on the content of the date field and the date field is a parent table field you could simply perform a find on the date field as startdate...enddate where the startdate and enddate values are entered while in find mode. ref the find operators in the FM help file.

This find could also be scripted to leverage the globals that doughemi mentioned.

 

Precise questions = precise answers

Share this post


Link to post
Share on other sites

thanks for the help so far - Ok I guess what what I was angling at was asking if it is possible to have two controls on my form that are unbound that can form the basis of my search. I cant see why I would need to create a global fields for two controls that are effectively orphan. (i.e. they don't need to bind to anything because they are just allowing a value to be selected and then for that value to be parsed as a query parameter).

 

Based on doughemi's answer I am guessing this is against the relationship based and tightly bound principles of FM. Which is fair enough lol.

 

 I will give the global fields a go. thank you for the suggestion.

 

One further thing if I may, can I add any logic to say that if any row on the main table my layout relates to has NO rows returned in the one portal included on the layout, omit it from displaying.

 

Many thanks

Share this post


Link to post
Share on other sites

Select the portal. In the Inspector, go to the Data tab, and under "Behavior" enter Count(YourPortalTable::SomeAlwaysPopulatedField) = 0 in the "Hide object when" field.

Share this post


Link to post
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
Reply to this topic...

×   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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.