clear values from field c# xpath? - InfoPath Dev
in

InfoPath Dev

clear values from field c# xpath?

Last post 05-14-2008 09:22 AM by boverton. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-14-2008 06:37 AM

    clear values from field c# xpath?

    Hello,

     I think I'm making this harder than it should be.  I have a survey form with 5 fields that I'm summarizing the values 1-5 chosen in a long list of radio buttons.  No problem reading the values of the radio buttons and populating the fields.   I've got the code in a view switched event and have multiple views so everytime it switches views it appends the values to the list.  I'm getting multiple values in my list.   All I want to do is clear the values in the Summary fields before I populate them.  Darned if I can figure out how to do it.   I think it must be easy but nothing I do seems to work. 

    (as an added bonus if anyone can tell me how to put in line breaks I'd appreciate it because the /r/n thing doesn't work)


    Thanks,Brad

    Here's my code I use to populate the summary fields: 

    XPathNavigator domNav = MainDataSource.CreateNavigator();

    XPathNodeIterator rows = domNav.Select("/my:myFields/my:Skills/my:Skill", NamespaceManager);

    XPathNavigator developing = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsDeveloping", this.NamespaceManager);

    XPathNavigator familiarfirst = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsFamiliar", this.NamespaceManager);

    XPathNavigator proficient = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsProficient", this.NamespaceManager);

    XPathNavigator advanced = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsAdvanced", this.NamespaceManager);

    XPathNavigator expert = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsExpert", this.NamespaceManager);

    // XPathNavigator na = domNav.SelectSingleNode("/my:myFields/my:RequiredSkills/my:SkillsNotApplicable", this.NamespaceManager);

    while (rows.MoveNext())

    {

    string skilllevel = rows.Current.SelectSingleNode( "my:Skill_Level", NamespaceManager).Value;

    string skillcategory = rows.Current.SelectSingleNode("my:Skill_Category", NamespaceManager).Value;

    string skillname = rows.Current.SelectSingleNode("my:Skill_Name", NamespaceManager).Value;

    string skillvalue = skillcategory + ": " + skillname;

    switch (skilllevel)

    {

    case "1":

    familiarfirst.AppendChild(skillvalue += "; \r\n");

    break;

    case "2":

    developing.AppendChild(skillvalue += "; \r\n");

    break;

    case "3":

    proficient.AppendChild(skillvalue += "; \r\n");

    break;

    case "4":

    advanced.AppendChild(skillvalue += "; \r\n");

    break;

    case "5":

    expert.AppendChild(skillvalue += "; \r\n");

    break;

    default:

    // na.AppendChild(skillvalue += "; ");

    break;

    }

    }

  • 05-14-2008 09:22 AM In reply to

    Re: clear values from field c# xpath?

    I knew I was making it too hard.  I figured it out.

     simply setting the xpathnavgator value to "" did the trick.   DOH!!!

     for example.

    developing.setvalue("");

     

    If anyone knows how to get those line breaks I'd love to know.

     Cheers,  Brad

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.