Zum Hauptinhalt gehen

Kommentare

6 Kommentare

  • Permanently deleted user
    Hi Emily,

     

    Unfortunately, our forum software was updated and all older posts were orphaned.  I can see the post you are referring to in our old system still, here is the answer that was posted -

     

    ----------------->

     

    The problem appears to be that all elements are evaluated whether or not they are actually used, and calling a string method on System.DBNull.Value produces an error.

     

    You should be able to get around this by using the following ugly hack:

     

    (SITUS_CITY == System.DBNull.Value ? "" : (SITUS_CITY + " ").ToString().Trim())

     

    This will ensure that the expression will always evaluate to a string, and thus the operation will always be valid.

     

     

    <-----------------

     

    I hope this helps, it's quite old!

     

    Regards,

     

    Wayne Richard

     

    Latitude Geographics Group Ltd.

     

    Head Office: 300 – 1117 Wharf Street  Victoria, BC Canada V8W 1T7

     

    Tel: (250) 381-8130 | Fax: (250) 381-8132 | wrichard@latitudegeo.com 

     

    Developers of Geocortex web-based mapping software | www.geocortex.com

     

    An Esri Platinum Business Partner

     

     
    0
  • Emily Renkema
    Thanks for the response, I'll give it a shot!
    0
  • Emily Renkema
    Hey Wayne, sorry about the late response

     

    This code does work when the date value is null (it leaves a blank space on the report), but when there is a value I get this:

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000XeJP&feoid=Body&refid=0EMf2000000YDhP"_/_img_

     

    Here's how I have it set up in the report:

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000XeJP&feoid=Body&refid=0EMf2000000YDhZ" _/_img_

     

    Anything stand out as being incorrect? Thanks again!

     

     
    0
  • Permanently deleted user
    Hi Emily,

     

    I have asked the original author of the workaround to comment.

     

    Regards,

     

    Wayne
    0
  • Yona Bystedt
    Hi,

     

    It has been a while, but I think the original code was assuming a string field. If the object is a Date, then it is invalid to concatentate a space with it. Try removing the + " " and see how that works:

     

    (RepairBy == System.DBNull.Value ? "" : RepairBy.ToString())
    0
  • Emily Renkema
    Darn, now it's the other way around. When the RepairBy field has a value, it shows up, but I get an error in the report when it's empty. It sounds like System.DBNull.Value is the right way to go, I just need to fiddle with it so it works with both cases. Thanks!
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.