Join values from two columns in one combobox?? - InfoPath Dev
in

InfoPath Dev

Join values from two columns in one combobox??

Last post 08-17-2006 02:45 PM by Greg Collins. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 08-09-2006 11:42 PM

    Join values from two columns in one combobox??

    Hi
    I have a table with two columns, first name and last name.
    Now I need to join these values to a combobox with first name plus last name. It also wpuld be very helpful to add another value, department for example.

    The joint values then are written in another table, but in its joint form.
    Is this possible and can anyone tell me how I could realize this?

    thanks a lot

    Millie
  • 08-10-2006 01:18 AM In reply to

    Re: Join values from two columns in one combobox??

    Hi,

    Yes, it is possible,
    First get the values from two columns and Add the two values and assign this value to combo box.

    Then bind this value to the table column you want.

    I hope this will help for you,
    Thanks.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 08-10-2006 02:19 AM In reply to

    Re: Join values from two columns in one combobox??

    Thanks! I will try this out, but as you may have noticed I got a bigger problem right now.

    Perhaps you can look at my other topic, too?
    I really need help....

    Millie
  • 08-10-2006 02:20 AM In reply to

    Re: Join values from two columns in one combobox??

    Sorry forgot to ask:
    how can I "get" and "add" these two values in Infopath?

    Millie
  • 08-10-2006 06:24 AM In reply to

    Re: Join values from two columns in one combobox??

    Hi,

    Try out this code.

    //Getting the two nodes,
    var value1 = XDocument.DOM.selectSingleNode("Xpath");
    var value2 = XDocument.DOM.selectSingleNode("XPath");

    //Getting the combobox node,
    var comboboxNode = XDocument.DOM.selectSingleNode("Xpath");

    //Assigning the value to the combobox node,
    comboboxNode.text = value1.text + value2.text ;

    I hope this will help for you,
    Thanks.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 08-10-2006 06:30 AM In reply to

    Re: Join values from two columns in one combobox??

    Oh I see I have to integrate code!
    I´m new to Infopath and haven´t worked with code yet. It´s time to try it out.
    But first I need to get my major problem solved. Perhaps also with code?

    Thanks for your help, I will print your answer to keep it for the next step!!
    millie
  • 08-10-2006 02:19 PM In reply to

    Re: Join values from two columns in one combobox??

    Unfortunately Millie this requires code in InfoPath. I also wish it weren't so. :)
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-11-2006 06:24 AM In reply to

    Re: Join values from two columns in one combobox??

    Why can't you just use the concat() function in the formula for the default value of this combobox node?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-11-2006 08:18 PM In reply to

    Re: Join values from two columns in one combobox??

    What is not possible is displaying the joined value as the display value in the dropdown. but if you just want to write the joined value to the other node then yes, you can use concat() as part of a rule which will fire every time the dropdown value is changed.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-14-2006 09:33 AM In reply to

    Re: Join values from two columns in one combobox??

    concat() is not directly supported in list boxes. However, you can manually modify your XSL to include a concat() function to make the drop-down list box display the two fields as one. I believe this has been discussed a couple times before in these forums.
  • 08-16-2006 12:36 AM In reply to

    Re: Join values from two columns in one combobox??

    @Ramana:
    OK, I tried following: I added a OnLoad-Routine to the Combobox. Then I insertet your code. This I modified.
    The XPaths of the values and the combobox I copied by pretending to set a fields value with a rule.
    But I am just too stupid to do the code thing right :-(
    Can´t I debug my code in the Script-Editor? When I click on the green "Start Debugging Sign" I get a Explorer Window with strange text ...
    Well I hope you can give one more advice, because right now its not working ...

    Thanks a lot anyway!
    Millie
    ---------------------------------------------------------------
    //Getting the two nodes,
    var value1 = XDocument.DOM.selectSingleNode("Xpath");
    var value2 = XDocument.DOM.selectSingleNode("XPath");

    //Getting the combobox node,
    var comboboxNode = XDocument.DOM.selectSingleNode("Xpath");
  • 08-16-2006 04:58 PM In reply to

    Re: Join values from two columns in one combobox??

    Sorry -- I should have posted a link to the example (assuming you wanted to try modifying the XSL):

    Display Multiple Fields in a Drop-Down List Box
  • 08-17-2006 03:08 AM In reply to

    Re: Join values from two columns in one combobox??

    Hi Greg, thanks!
    I tried your help -concat-function in XSL-File-, but it does not work.
    I´m sure I made a stupid error.
    First: what a binding and what kind of data does the combobox need? I chose a primary-binding and fill it with the data of the secondary con, the last name of the person.
    Then I opended th XSL file and there I found the relevant part, but: in your example you write something like "my:name". In my XSL I found "@Name"?!?! I tried both, the @-Version and your version, but obviously it doesn#t work.
    Perhaps you can help me once more?

    Millie
  • 08-17-2006 02:45 PM In reply to

    Re: Join values from two columns in one combobox??

    You need to make sure you follow the structure your data source uses. The "@" indicates that the name node is an "attribute". "my:" is a namespace prefix. If yours didn't already have a namespace prefix (some few characters followed by a colon), then you might not need to use a prefix depending on what nodes you are trying to concatenate. If you have an attribute with a namespace its written like this: "@my:Name".

    Remember--the article is just a reference and your data will not always look the same.
Page 1 of 1 (14 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.