Using EVAL and concat for concatnating fields in repeating tables - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Using EVAL and concat for concatnating fields in repeating tables

Last post 09-18-2013 06:48 AM by giustis5. 28 replies.
Page 1 of 2 (29 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-29-2008 08:32 AM

    Using EVAL and concat for concatnating fields in repeating tables

    Hi

    I have been trying to use info found in http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx

    In December I managed to create a field (AliasesConcat) which was a concatenation of a repeating field using 
    eval(eval(AliasesGroup, 'concat(my:Aliases[. != ""], "; ")'), "..")

    ApplicationGroup
         ApplicationNameGroup
         AliasesGroup (repeating)
              Aliases(repeating)
         AliasesConcat

    BUT I cannot create any more.  Christmas has damaged my brain cells - I obviously don't understand the concept as I thought I did.
    I want to concatenate the values in ApplicationServer into ServerConcat(see below)  I keep getting the error msxml5.dll - reference to undeclared namespace prefix my.
    Do I have to have my ApplicationServer field as repeating ? 

     ApplicationGroup
         ApplicationServerGroup (repeating)
             ApplicationServer
         ServerConcat. 

    Could someone point me in the right direction.

    Thank you

    Catharine 

     

  • 01-29-2008 09:10 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Hello Catharine,

    no reason why it would not work... I have created your schema as you have specified it and my eval works:

    xdMath:Eval(xdMath:Eval(../my:ApplicationServerGroup, 'concat(my:ApplicationServer, ";")'), "..")

    The way you have your schema seems right, why would you want ApplicationServer to be repeating anyway?

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-29-2008 11:39 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

     

    I'm having the exact problem.  My Schema is:

    Skills

    Skill

                    Skill_Level

                    Skill_Name

                    Skill_Category

    Skill

    Skills

     

    I'm having some success,  I have a repeating table with 125 Skills that people are ranking from 1-5 via radio buttons.   I'm trying to have 5 text fields that seperate the skills by the chosen Levels.

    This code populates the fields with 125 SemiColons and the values chosen (this code would give me 125 semicolons but also the correct values of Skills ranked as a 3)

    eval(eval(Skill, 'concat(my:Skill_Name[../my:Skill_Level = "3"], "; ")'), "..")

    so I'm Close I'm just getting extra semicolons

     

    This code populates the fields with the correct number of semicolons but no values  (If someone ranked 3 skills as level 3 I would only get 3 semicolons, but no Skill Names)

    eval(eval(Skill[Skill_Level = "3"], 'concat(current()/*/Skill_Name, "; ")'), "..")

     

    Maybe one of these will help you and maybe someone can tell me what I'm doing wrong. 

     Thanks to anyone who can help.

     

  • 01-30-2008 03:01 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Thank you very much for the reply.   I have cut and pasted it into my form and it works.

    I have done some more investigating in both edit xpath and ordinary views of the formula box and I can understand my confusion....

    With edit xpath ticked.
    YOURS - xdMath:Eval(xdMath:Eval(../my:ApplicationServerGroup, 'concat(my:ApplicationServer, ";")'), "..")
    MINE    -  xdMath:Eval(xdMath:Eval(ApplicationServerGroup, 'concat(my:ApplicationServer, "; ")'), "..")
    OBVIOUS DIFFERENCE I had missed the ../my:

    With no edit xpath ticked
    YOURS - eval(eval(ApplicationServerGroup, 'concat(my:ApplicationServer, ";")'), "..")
    MINE    - eval(eval(ApplicationServerGroup, 'concat(my:ApplicationServer, "; ")'), "..")
    DIFFERENCE NOT OBVIOUS  when trying to compare commands like this (which I think is why I couldn't understand why my previous one was working and this one wasn't) - but in the edit box your ApplicationServerGroup is underlined.

    Hopefully writing it out like this will help me get it right in future and maybe help others.  I will certainly have the edit xpath ticked in future for this command.

    THANK YOU AGAIN

    Catharine

  • 01-30-2008 04:25 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Hi, I thought I had this sorted....So using my new found understanding, as a test I thought I would have a look at boverton's problem (reply to my original post.)

    I have a Schema
    Skills
       Skill(repeating)
           Skill_Category
           Skill_Name
           Skill_Level
       Skill_Concat

    And in Concat I have
    xdMath:Eval(xdMath:Eval(../my:Skill, 'concat(my:Skill_Name, ";")'), "..")

    I get the error
    msxml5.dll
    Reference to undeclared namespace prefix: 'my'.
    I have compared it to your original and I just cannot see the difference - can you see the error ?

    I have also tried
    xdMath:Eval(xdMath:Eval(../my:Skill, 'concat(../my:Skill/my:Skill_Name, ";")'), "..")    - and get the same error

    Thank you

    Catharine - Perplexed

  • 01-30-2008 05:50 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Yes Catharine,  I have tried just about every variation of my:Skill_Name and I either get no error but also no values written to field or I get the  msxml5.dll
    Reference to undeclared namespace prefix: 'my'.

    Anyone out there know what's going on here?  

     Thanks!

    Brad

  • 01-30-2008 12:27 PM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    This is very strange, I have tried exactly what Catharine said and it works very well for me. Obviously it was not the exact same thing...

    Can you share out your solution XSN? I am not able to reproduce your problem from the information you have provided so far.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-31-2008 07:15 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    I am now MORE confused than ever.  I know that you are not going to believe what I am writing here - (Mad women doesn't know what she's talking about !! Is what you are going to think) - But I am going to set down here exactly what I have done.....

    I got your e-mail this morning and decided to have another go prior to sending/attaching the xsn.  I went into my infopath form, and typed my command longhand into my concat field and verified it..... It worked no problems - Yesterday I could not get it to work at all.  So I figured that I must have made a mistake yesterday.  So I cut and pasted the verified command - it looked identical to the one I was trying yesterday.  Then I cut and pasted the one I showed in yesterday's e-mail into the field and it verified.  FREAKY.

    I have done the following twice... so I have some level of consistency on my machine.

    I have created a BRAND NEW template with the Data

    Skills
       Skill(repeating)
           Skill_Category
           Skill_Name
           Skill_Level
       Skill_Concat

    I have gone to the Skill_Concat field and cut and pasted...
    xdMath:Eval(xdMath:Eval(../my:Skill,'concat(my:Skill_Name, ";")'), "..")
    verified and got the error

    I have then saved(NOT Published) the template....
    cut and pasted...
    xdMath:Eval(xdMath:Eval(../my:Skill,'concat(my:Skill_Name, ";")'), "..")
    verified and got the error

    I have then closed the template and opened it again
    cut and pasted...
    xdMath:Eval(xdMath:Eval(../my:Skill,'concat(my:Skill_Name, ";")'), "..")
    and it has verified with no errors

    I don't know what this is indicating - maybe I have a glich in my installation - I could attach my xsn - but having saved it it would work.....

    BUT... even though  the command above works I cannot get filtering to work  but it could be that the command is wrong.... I have tried
    xdMath:Eval(xdMath:Eval(../my:Skills, 'concat(my:Skill_Name[. != " "], ";")'), "..") and
    xdMath:Eval(xdMath:Eval(../my:Skills, 'concat(my:Skill_Name[. != ""], ";")'), "..") - no verify error - but I get floating ; when the field is blank - was hoping to filter out empty rows

    xdMath:Eval(xdMath:Eval(../my:Skills[Skill_Level = 3], 'concat(my:Skill_Name[. != " "], ";")'), "..")  - get same verify error.

    Sorry for the long ( and unbelievable) reply - I guess I just have to keep saving and opening my templates(?) but I would like to know the correct format for using filtering in this command.

    Thanks for reading

    Catharine

     

     

     

     

  • 01-31-2008 07:30 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    You might be just hitting some obscure bugs or limitations of InfoPath - after all this is pretty advanced stuff which uses an undocumented feature (who would have known that eval() actually returns an xml tree?)

    As a matter of fact, "undocumented" sort of means Microsoft reserves the right to change it any time and we cannot blame them :)

    Now, these comments aside right now it would probably be best for you to share out the solution so that I could take a peek.

    By the way, this method is only good if you are trying to keep your solution codeless. If you already have some code in your solution, doing it it code is much easier and less whacky.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-31-2008 07:53 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Hi

    In this example I have not got any code - and I do like the idea of an elegant solution - so I would like to know as much as I can about this for the future...... In the form I actually wanted to do concatenations on I have got code behind it...( though that has died see http://www.infopathdev.com/forums/p/7136/26097.aspx#26097 LOL - either that or cry....)   So if/when I get that working I think I will use the code option ....

    I have the xsn ready to 'share out' how do I do that - sorry for the newbie question - I haven't done it before.

    Catharine

  • 01-31-2008 08:03 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Ok, just to throw in some more info that might help.    This repeating table is based on my Main Datasource.   When I first used this It was based on a secondary data source.    If I have a repeating table based on a data conection (Skills_List) then this formula works like a charm:

    eval(eval(Skills_List[@SkillLevel = "1"], 'concat(@Skill_Name, ";")'), "..")   

     

    To Summarize where we are at we've got the first part of this formula to work which filters our list based on Skill Level.  

    eval(eval(Skill[Skill_Level = "3"], 'concat(my:Skill_Name, "; ")'), "..") 

     Our problem "reference to my"  is occuring on the concat.   I'm fairly new to xpath and XML but I think our problem is we're getting a node and not a text value.  I think we need to figure out how to return the text of my:Skill_Name.   (or I could be wrong)   

     

  • 01-31-2008 09:39 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    For both Catharine and boverton:

    If you have an XSN it'll probably be good to upload it here so that I could take a look:

    http://www.infopathdev.com/files/folders/community_uploads/default.aspx

     

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-31-2008 09:50 AM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    uploaded http://www.infopathdev.com/files/folders/community_uploads/entry26121.aspx

    Administrator Note: This link appears to be obsolete - user added content.

  • 01-31-2008 04:51 PM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Thanks, Catharine. It is unfortunate but it looks like you're banging your head against InfoPath xpath limitations.

    You see, xdMath:Eval(xdMath:Eval(../my:Skill,'concat(my:Skill_Name[. !=""], ";")'), "..") does not work. The reason for that is simple:

    The inner eval selects ALL my:Skill nodes and does something to them, the filter does not really help. What you really want is this:

    xdMath:Eval(xdMath:Eval(../my:Skill[my:Skill_Name != ""],'concat(my:Skill_Name, ";")'), "..")

    Unfortunately, InfoPath barfs at that. I think code might be your better solution if you need to filter.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-31-2008 09:56 PM In reply to

    Re: Using EVAL and concat for concatnating fields in repeating tables

    Thank you both very much for your efforts.   I still don't know why this will work on a secondary data source but not the main data source.   Someone smarter than me will have to figure it out.  
Page 1 of 2 (29 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.