Table filter field Assisted edit

mabl4367mabl4367 Member Posts: 143
Hi all!

I have created a custom table "MyTable" with a field "TableFilterField" of type TableFilter. The property TableIDExpr of the field is set to 36 (Sales Header).

If i run the table I automatically get the assisted edit button on the field to help me construct filters.

I have created a new form with a global variable "recMyTable" of type Record and subtype MyTable. On the form i have placed a textbox with the SourceExpression set to recMyTable.TableFilterFiled.

However I can not get the assisted edit button to work on the textbox. I can make it show an assisted edit button by setting the assisted edit property on the textbox but it does not open the correct form when pressed.

What should I do?

Answers

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV Tips & Tricks' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • SavatageSavatage Member Posts: 7,142
    So you have a table that holds set filters.
    you want a lookup to that table from a form.
    when you select one of those set filters you want it filter the list on your form.

    is that what you are saying?

    Say I have an Item list for example.

    but i want to filter it by "Gen Prod Posting Group" but I don't want to type in the GPPG code everytime.
    so I would rather pull the choices up on a lookup textbox & when I return the value it should filter my form.
    I would create a GlobalVariable GenProdPostGroupFilter
    type code length 10 - the same size as it exists on the table

    on the form a add a textbox with GenProdPostGroupFilter as the sourceexp.
    and "Gen. Product Posting Group" as the tablerelation to lookup the values from the table.

    OnAfterValidate() of that textbox
    SETFILTER("Gen. Prod. Posting Group",GenProdPostGroupFilter);
    CurrForm.UPDATE;

    you mean something like that?
  • mabl4367mabl4367 Member Posts: 143
    I will try to be a little more specific.

    When we take delivery there are some checks that have to be preformed on the goods delivered. What checks should be preformed depends on many factors.

    The idea is that for each type och check (registered in a custom table) we want to be able to specify the configuration of these factors by defining a filter that when the order (Sales Header and Sales Lines) passes the filter then the check should be preformed by the staffmember taking delivery.

    I added two fileds of type TableFilter to the quality check table. When we take delivery , if the Sales Header and Sales Lines pas the filters defined in the quality check table the check should be preformed.

    Since there is always a risk of getting the syntax in the tablefilter wrong I would like to have the AssistEdit button working on the forms where i display the TableFilterFields.

    It is working when I run the table and when i create a tabular type form directly for the table. However if I create a form based on another table and just add a textbox where the sourceExpression refers to one of the TableFilter fields of the quality check table the AssistEdit button no longer appears.

    I think I'm going to stop trying to use the datatype TableFilter entierly because it seams I cant find any functions that take any parameters of that datatype. SETVIEW, SETFILTER etc all take strings.

    Frankly I don't understand what the TableFilter data type is supposed to be used for.

    Thanks anyway!
  • BernardJBernardJ Member Posts: 57
    At MSDN i read this can only be used when setting security filters from the Permission table

    http://msdn.microsoft.com/en-us/library/dd355293.aspx
  • David_SingletonDavid_Singleton Member Posts: 5,479
    mabl4367 wrote:
    Hi all!

    I have created a custom table "MyTable" with a field "TableFilterField" of type TableFilter. The property TableIDExpr of the field is set to 36 (Sales Header).

    If i run the table I automatically get the assisted edit button on the field to help me construct filters.

    I have created a new form with a global variable "recMyTable" of type Record and subtype MyTable. On the form i have placed a textbox with the SourceExpression set to recMyTable.TableFilterFiled.

    However I can not get the assisted edit button to work on the textbox. I can make it show an assisted edit button by setting the assisted edit property on the textbox but it does not open the correct form when pressed.

    What should I do?

    This only works in the scope of the current record (rec) you can't use this property for a different variable. i.e.

    SourceExpression set to TableFilterField WILL work

    SourceExpression set to MyTable.TableFilterField WILL NOT work

    In the second case you need to do the look up in code.
    David Singleton
  • mabl4367mabl4367 Member Posts: 143
    Thanks for all the help!

    I'm now looking into using the request-form of a report to create an interface for creating the filter.

    I will use a Text-field instead of a TableFilter-field. In the OnAssitEdit trigger of the table i will run a processing only report with a Sales Header data item. Processing is aborted imedietly and the filters set by the user will be accessable through a call to a function that I will create in the report.

    This sould work I think.
Sign In or Register to comment.