Double eval, in a customize SharePoint/Infopath form - InfoPath Dev
in

InfoPath Dev

Double eval, in a customize SharePoint/Infopath form

Last post 11-10-2011 09:41 AM by jaxkookie. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-10-2011 06:32 AM

    Double eval, in a customize SharePoint/Infopath form

    I have been struggling with the cascading field functionality in sharepoint with customizing the form using infopath. The main issue I was having is you must use the items ID for the value. Although this works great for the cascading some of the issues I was running into was opening the form to edit sometimes displayed the ID and not the display name. with a few tweaks I was able to implement a work around. now my problem lies with a lookup field that is multiple select. I tried several methods to get the displayname

    1. added a multiple select field to IP. this functioned perfectly, except when you edit the form in datasheet view. IP added the field to SP as a choice field and only added the SP default values. editing in data sheet would throw an error because the value never match. So as long as the data is managed in the form no issues or errors

    2. I added the lookup to SP, still have the issues of the ID. I need the display name because I am using this data with a few stored procedures. Although I can make it work with the ID's I will never remember what ID is what value

    So I figure I can use the double eval to write the displayname to a text field. Again I am very close to a solution but not quite there. because it is a customized SP form using IP, IP has a few limitations. I want to write my selected "DisplayNames" with a semi-colon delimiter. Several methods I tried either build the string of displayname with no spaces or I get a large leading space  built with no semi-colon delimiter. I am not set on any one solution. I am already using buttons to apply other rules getting the values from single select lookups. it is the multiple select lookup that is killin me.

    can I write the displayname from a SP lookup field to a text field with a IP customized form?

    thanx

    Kind regards,
    Larry
  • 11-10-2011 09:41 AM In reply to

    Re: Double eval, in a customize SharePoint/Infopath form

    whew! I figured it out, what a pian in the neck this does not work easier. After writing the post I remembered an old post related to cascading fields. I remember that the data sources had to be replicated. I dont remember the reason, but I went an added my lookup data source a second time. I also used an xml file to insert a newline. With my multiple select lookup field I have a button, so once I am done selecting my  values, it will run a rule to update a text field and submit my form. Keep in mind this is a customized sharepoint form. the rule is to set a field value and looks like this

     XPath:

    substring-after(xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM("Region1")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title[. = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:Region/Value], 'concat(xdXDocument:GetDOM("characters")/characters/@crlfb, .)'), ".."), xdXDocument:GetDOM("characters")/characters/@crlfb)

     rule:

    substring-after(eval(eval(Title[ID = Value], 'concat(xdXDocument:GetDOM("characters")/characters/@crlfb, .)'), ".."), @crlfb)

    I am not going to explain the double eval. there are already many post on this site for that. toi get my scenario to work this was the key:

    Title[ID = Value]

    Title in my second (replicated) data source. and Title is the title field used in the look up, then I just compared the ID to the value of the multiple select. on button click each value display name is written with a semi-colon each on a new line.

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