Reading a Null Key via a webservice

PhiltooPhiltoo Member Posts: 36
edited 2009-08-18 in NAV Three Tier
Ok, the "Company Information" table has one record who's primary key is a null value. How do I read this record through a webservice? I can't do a companyInfoService.Read(null);, I get a soap exception, it doesn't like the null value. I also tried passing it a space, and I get a soap error that the primay key is an empty value.

How can I read this single record without building a filter and doing a readmultiple?

Thanks, Phil

Answers

  • ara3nara3n Member Posts: 9,255
    Company Information table primary key isn't null value. It's an empty string.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • PhiltooPhiltoo Member Posts: 36
    That may be the case, but even so you can't read a String.Empty either.

    companyInfoService.Read(String.Empty); generates an unhandled soap exception "Parameter Primary_Key is empty"

    Problem is the record I'm trying to read has an empty key so this is a valid call. So how do I read this record?!
  • PhiltooPhiltoo Member Posts: 36
    We figured it out. (A Co-Worker)

    Use an asterisk to indicate an empty key. Like this:

    CompanyInfo companyRec = companyInfoService.Read("*");

    That returns the 1 record in the table which is keyed with an empty string.


    Thanks, Phil Henn
Sign In or Register to comment.