Avoid Factbox records on Empty pages

Factboxes are more then ever a powerfull way for presenting related information. Normally you link your Factbox through properties, but now and then you need to do this from code.

This works fine if your page has at least one record, because the filtering is set on the “OnAfterCurrRecord” trigger of the page. So when there is no records, no filter is set on you factbox and then all related records are shown.

And that is not the meaning.

So what can you do to avoid this annoying behavior?
I figured out a way. ļŠ

Just to make my factbox look empty, I place the following code on the “OnFindRecord” trigger of the factbox.

capture

The system will check if there are filters and if there are none I raise an empty error. But because I put the ASSERTERROR before it, the system will not show the error and my factbox is empty as you can see.

It is not rocket science but maybe helpfull to make you solution look nice in every situation.

Ā 

5 thoughts on “Avoid Factbox records on Empty pages

    1. Punky says:

      Hi Alain,

      I wouldn’t post it if it doesn’t work. But it would be better if Microsoft can add a property to achieve this by default as Natalie proposed.

      Greetings,
      Gunter

  1. Natalie says:

    Thank you. But imho Microsoft should add an option to the FactBox link to achieve the same effect without coding, and enable it by default. Maybe you want to post that yourself on MS Connect …?

  2. Punky says:

    Just updated my post.
    You need to take the “OnFindRecord” trigger instead of the “OnNextRecord”.
    Because it will not work if you have only 1 record.

Leave a Reply to Punky Cancel reply

Your email address will not be published. Required fields are marked *