Options

Page: How to GETFILTERS from Web Service

mbjmbj Member Posts: 63
edited 2009-10-12 in NAV Three Tier
Page:

C#:
filter[0].Criteria = "Test";

I can not read the filters from the Web Service on the triggers OnInit() or OnOpenPage()

GETFILTERS are empty

I have also tried the diffrent filtergroups 0..

Comments

  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    Could you post the rest of your C# code - just to make sure that filters are applied correctly when invoking your web service method
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    mbjmbj Member Posts: 63
    The filter works and i get 3 records. But in NAV the getfilters are empty?

    Functions on pages are not visible from the Web Service? Therefore i will use the filter instead.

    My C# code for filters:

  • Options
    DenSterDenSter Member Posts: 8,304
    mbj wrote:
    in NAV the getfilters are empty?
    What do you mean by that? How did you check this?
  • Options
    mbjmbj Member Posts: 63
    if getfilters()<>'' then from the triggers OnInit(), OnOpenPage() are always empty

    I will use the filters to create myRec and then overwrite the current Rec on the Page with myRec. (because functions in pages not are available from C#)

    *****
    Other solution is to create a function i a Codeunit with parameters - but then i have to return my own xml dataset and not the smart Page?

    *****
    Note the filters are available from the trigger OnAfterGetRecord() (but then there need to be at least one record)
  • Options
    mbjmbj Member Posts: 63
    note:
    getfilters are used on Page 658 OnOpenPage() buy will not work from a web service - only in the Role tailed Client
  • Options
    DenSterDenSter Member Posts: 8,304
    I guess I am just missing something, because you are making absolutely no sense at all to me. Are you implementing a web service or modifying a page, or implementing a web service on a page?
  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    You do know that you have the ability to create a function and expose this on the page by exposing a codeunit with the same name as the page and removing the checkmark in Published - right?

    Maybe this is a different solution to your issue.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    mbjmbj Member Posts: 63
    freddy.dk it sounds interesting – can you give me a example?

    What do you mean by removing the checkmark in Published for the Codeunit or the Page?
  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    Put the following code in a codeunit
    GetBookmark(Key : Record Customer) bookmark : Text[1024]
    ref.GETTABLE(Key);
    bookmark := FORMAT(ref.RECORDID, 0, 10);
    

    Expose this codeunit with the name Customer in the WSTable (Look image)

    If you now look at the WSDL for the Customer page you will see your function exposed on that:
    <binding name="Customer_Binding" type="tns:Customer_Port">
      <binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> 
    - <operation name="Read">
    - <operation name="ReadMultiple">
    - <operation name="IsUpdated">
    - <operation name="Create">
    - <operation name="CreateMultiple">
    - <operation name="Update">
    - <operation name="UpdateMultiple">
    - <operation name="Delete">
    - <operation name="GetBookmark">
      </binding>
    

    And calling this from C# looks like:
    string bookmark = service.GetBookmark(customer.Key);
    

    Hope it solves your problem
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    mbjmbj Member Posts: 63
    The filter problem is not solved i SP1? It is still not possible to get filters oninit and onopen triggers on pages published as webservice.
  • Options
    dastdast Member Posts: 1
    I have a question regarding a similiar "issue": Is it to dynamically change the data in the response of a web service request (without physically changing the data in the table)?
Sign In or Register to comment.