How to clear records from a table box control?

Can anyone please explain on how to clear the records in table box before submitting a search criteria?

The problem here is - in my custom form, the table box displays the records as per the search criteria PLUS the last record from the previous search. So I need to clear the table box while submitting the search criteria (just before displaying the new resultset).

Thanks

You need to expalin what you are doing here. At a guess it looks like you have created some custom search tool, but how can we know that or know what code you have written, or even help you if you want to keep all that a secret. [:(]

I have a custom form with a text boxes and a table box. The text box accepts search value (date - defaulted to Current date) for the “Alert Date” field (custom field added on Comment Line table) and displays corresponding records on Table Box.

I’m using a single line of code on the OnValidate() trigger for the Alert Date textbox and it is as follows.

SETFILTER (“Alert Date”, ‘=%1&=%2’, CommentsAlertDate, CommentsAlertDate);

CommentsAlertDate is a variable that takes TODAY; as the default value when the Form loads.

When I open it for the first time, the form displays all the comments for current date. But, when I try to search comments for another “Alert Date”, the table box is not clearing all the records. The last record from the previous search remains there.

Thanks,

Did you try making a RESET before filtering again?

I tried it now. But that didn’t worked.

Below is the code.

CommentsAlertDate :=CommentsAlertDate;
SETFILTER(“Alert Date”,’=%1&=%2’,CommentsAlertDate, CommentsAlertDate);

Thanks,

Well, I’m afraid the first line doesn’t seem to be good. I refered to use the RESET function of your record var (the one you use to make the SETFILTER), ej:

RESET;
SETFILTER(“Alert Date”,’=%1&=%2’,CommentsAlertDate, CommentsAlertDate);

The reset function removes all previous filters on your record var !!

In which trigger did you put that code? What’s the assigning line for? Why are you using the same field name twice in the SETFILTER?

You need to explain WHAT you are trying to achieve, NOT HOW you are trying to do it.

Grrrrrrrrrrrrr . [6]

We are trying to make a screen where our Credit Control department users can search for entries added on Comment Line table.

The Credit Control department uses the customer comments sheet for adding the follow up details or other comments whenever they make calls to the customer.

Now, they require an option to add the next follow up date (Alert Date) and a search functionality on comments table based on the Alert Date field.

Thanks,

Also, can anyone please look into the below post as well.

http://dynamicsuser.net/forums/p/23003/118849.aspx#118849

Hi All,

Any help on the Table Box query?

Thanks,

Vinod

Hi,

We’ve added one more field to store the user name to the comment line table. Our aim is to provide the user with an option of seaching the comments - filter by user name / alert date.

Right now our code is as follows. This runs in the OnValidate() trigger on a text box control.

RESET;
SETFILTER(User,’=%1’,CommentsEnterUser);
SETFILTER(“Alert Date”,’=%1’,CommentsAlertDate);

The CommentsEnterUser and CommentsAlertDate are variables that pick the values from two text boxes.

Is there a way where we can filter the records - by name, by alert date, by name & alert date?

Thanks.

Why not teach the client to use F7? Surely that will be cheaper and easier for them?

Yes thats an option, will look into that as well.

In the comments list form there is a event which fires on “double click”, would be interested to know how can I do the same. Tried to look around in that page for the double click event but didn’t find it. Can you guide us as to how to do that.

Thanks and regards

Also, how can we disable the form close on the double click event of the Comments List form.

It doesn’t really exist this “double click” event, it’s an internal function when you display a LookUp form. For example if you go to Orders and press F5 you’ll be able to “double click” on the list and the current order will be displayed on the form Card.

If you put code on the “OK” button of the form, this will be executed when you “double click”, maybe you can try something this way [*-)]