Filter Onlookup

SkinnerwiiSkinnerwii Member Posts: 3
I want to have a filter set on the service header (service order form) and the service line. The filter needs to show only some Locations (Table Location) and not all of them. To do so I added a field to Table Location which is called "Service Location". This is a Boolean field.

For some reason I cannot get the filter working. This means if I do a lookup on the Location Code field in Service order or Service line the filter is not applied. In Sales order I do not want to have this filter at all.

Any ideas how to solve this?

Comments

  • MBergerMBerger Member Posts: 413
    To be able to help you , we'll need to know a bit more on what you have already done that isn't working. You added a boolean, but where and how are you trying to filter?
  • hansiangbinushansiangbinus Member Posts: 3
    Skinnerwii wrote:
    I want to have a filter set on the service header (service order form) and the service line. The filter needs to show only some Locations (Table Location) and not all of them. To do so I added a field to Table Location which is called "Service Location". This is a Boolean field.

    For some reason I cannot get the filter working. This means if I do a lookup on the Location Code field in Service order or Service line the filter is not applied. In Sales order I do not want to have this filter at all.

    Any ideas how to solve this?

    Go Service Header Table, Design, Go to Location Code Field, Properties, table filter, then add filter : Field = Service Location, Type = Filter, Value = True.

    is that answer ur questions?
    Thank you..
  • SkinnerwiiSkinnerwii Member Posts: 3
    Thanks for the response. Okay let's try to clear this up a bit.

    I have added a boolean called Service Location to table Location. This is meant to be used to display only the selected locations to the Service Technicians.

    I have added a Code10 Default Service Location tot Service Mgt. Setup which is used as default service location in Service Header and Service Line

    If a user adds a new line to Service Item Worksheet Subform it should point automatically to the Default Service Location instead of the default (Sales) location. Also when the user wants to pick the location in this subform it should only display the ones which have Service Location checked.

    Hope this helps. At this stage the filtering does not work at all, I tried using TableRelation Property on the Location Column in the subform but that was not of any help. Also putting a default filter on the Location table is not an option because of the Sales and Purchase dept.

    Hope this helps...
  • EdZEdZ Member Posts: 10
    In the AfterGetCurrRecord of the LineSubform you would have to lookup the default Service Location programmatically and put it into the location code.

    In the OnLookup trigger of your location control you can do someting like this to filter the list available to chose from:

    // LF_Location = Location List Form
    // LR_Location = Location table

    CLEAR( LF_Location ) ;
    LR_Location.SETRANGE( FielName, "Value To Filter" ) ;
    LF_Location.LOOKUPMODE( TRUE ) ;
    LF_Location.SETTABLEVIEW( LR_Location ) ;
    IF ( LF_Location.RUNMODAL = ACTION::LookupOK ) THEN
    BEGIN

    LF_Location.GETRECORD( LR_Location ) ;
    "Location Code" := LR_Location."Code." ;

    END ;

    CLEAR ( LF_Location) ;

    NB !! field names in this code are guessed
Sign In or Register to comment.