locked
2 codablevalue issues RRS feed

  • Question

  • I'm having 2 problems with Codablevalues:

    1. Codablevalue.Text does not permit null values, or empty strings. So for example, a user might have an allergy, but is not treating it. So, it seems Allergy.Reaction should allowed to be empty/null.

    But I always get:

    The value of the Text property cannot be null.
    Parameter name: value
       at Microsoft.Health.ItemTypes.CodableValue.set_Text(String value)

    2. HealthVault *sometimes* inserts bogus characters in my strings. So, for example, on 2 different occassions, I tried to save

    'n/a' as the Codablevalue.Text for Reaction. In one case, I got: 'n/a', and in the other, I got: 'n_x002F_a'
    similary with spaces: sometimes, what gets stored looks like:  'mick_x0020_jagger_x0020_lips', instead of 'mick jagger lips' for the Reaction
    Saturday, June 28, 2008 3:09 AM

Answers

  • eric,

    thanks for the help. the logging worked and showed the issue was with the xml serialization, not HealthVault.

    what happened was we used xsd.exe to generate the xml stuff on example files like this:

    <Status>Ongoing</Status>

    i think xsd saw that there weren't any spaces in the example, so assumed the data type was "NMTOKEN", which of course does not allow spaces (xml doesn't allow spaces in the names of nodes).

    problem solved.
    Monday, July 21, 2008 3:23 PM

All replies

  • 1. Can you show the code that your are using? This works:

     

    Allergy allergy = new Allergy();

    allergy.Name = new CodableValue("work");

    PersonInfo.SelectedRecord.NewItem(allergy);

     

    2. It looks like something is doing translation/escaping of characters. Can you describe the environment you're using?

    Monday, June 30, 2008 4:38 PM
  • Sorry for the delay in getting back on this. But...

    I sorted out (1).

    On (2) though, still having issues. We have a 2-tier environment:

    We are using php as the presentation layer and .NET for everything else. So, we built a Web Service (SOAP) to talk between the 2 layers. The php calls the WS and then the .NET turns around and talks to HealthVault.

    The xml seems fine when it gets over to the .NET layer:

        <Condition>
          <Name>Allergies</Name>
          <OnsetDate>05/04/2008</OnsetDate>
          <Status>Allergic to work as well</Status>
          <StopDate />
          <StopReason />
          <Comment>That&apos;s why there was a delay in getting back.</Comment>
          <Id />
        </Condition>

    But then, I set the HealthVault Condtion.Status to the above value:

    hvCondition.Status = GetCodableValue(condNow.Status);

    where 'GetCodableValue' is just a little wrapper:

            public Microsoft.Health.ItemTypes.CodableValue GetCodableValue(string value)
            {
                    return new Microsoft.Health.ItemTypes.CodableValue(value);
            }

    But, then, I pull stuff out, and it looks like this:

    Allergic_x0020_to_x0020_work_x0020_as_x0020_well

    So it seems like the weirdness is coming on the HealthVault side - taking the string out of the unserialized object and sticking it in the HealthVault object.??

    An help would be awesome.

    Tuesday, July 15, 2008 10:04 PM
  • I haven't come across any partners who are architecting things the way that you are, so it may be hard to give you specific help.

     

    I'd start by turning on request response tracing to see exactly what is being sent to the platform and what is coming back. That should help narrow things down.

     

    If that doesn't help, feel free to reply and I'll see if I can be more helpful.

     

    Thursday, July 17, 2008 4:32 PM
  • eric,

    thanks for the help. the logging worked and showed the issue was with the xml serialization, not HealthVault.

    what happened was we used xsd.exe to generate the xml stuff on example files like this:

    <Status>Ongoing</Status>

    i think xsd saw that there weren't any spaces in the example, so assumed the data type was "NMTOKEN", which of course does not allow spaces (xml doesn't allow spaces in the names of nodes).

    problem solved.
    Monday, July 21, 2008 3:23 PM
  • I was hoping that would be the case. Glad that it's working...

     

    Monday, July 21, 2008 5:27 PM
  • Hi,

    as for the first problem, where you have no value to define in reaction, just leave it empty or default to string.empty. So, try this code:

     

    Allergy allergy = new Allergy();
    allergy.Name = new CodableValue("AllergyName1");
    allergy.Reaction = new CodableValue(string.emtpy); // or just don't skip this line.

    Regards


    Mustafa Al-Durra, B.Sc Computer Engineering, MCP, MCDBA, MCAD.NET, SoftHealth Inc. (President/CEO)
    Saturday, August 28, 2010 7:24 PM