Repeating Tables and Current() - InfoPath Dev
in

InfoPath Dev

Repeating Tables and Current()

Last post 08-06-2012 12:40 AM by rajkumar.bathula. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • 05-17-2012 06:41 PM

    Repeating Tables and Current()

    Hi, I am currently battling with a Repeating Table and Date Formatting.

     All date fields are to be formatted as Mon, 23 Dec 2013, readable but not as bulky as the long date format.  I'm using QRules (trial version).

    For date fields which are not in a repeating table I have successfully managed, using a rule with a set of three actions:

    1.  Action -  Set a field's value 
         Field - CommandTravelDate
         Value - concat("FormatDate /date=", . , "format=", FixedFormat)  //where FixedFormat is a hidden field with the date format

    2.  Action - Set a field's value
         Field - Command
         Value - CommandTravelDate

    3.  Action - Set a field's value
         Field - ProposedTravelDateStartDisplay
         Value - Result

    The rule runs when the initial datepicker value changes.  

    My difficulty arises when I try to do the same thing in a repeating table.  The first two rules are the same but the third uses a formula:
    concat("SetValue /xpath=/my:myFields/my:TravelDetailItems/my:TravelDetailItem[ insert something here ]/my:TravelDateDisplay /value=", Result)

    I have tried several versions of the formula and while I can get it to fill all the fields or the last one I have been unsuccessful in getting it to fill just the current one.  Unfortunately for me, I have been assiduously avoiding xPath and am now forced to embrace it.

    Any help gratefully received.

    Cheers

    Tony..

  • 05-17-2012 10:33 PM In reply to

    Re: Repeating Tables and Current()

    In the repeating table case, where is the datepicker that has the rules on it located?  If it's in the repeating table, you should be able to use an ordinary Set a field's value rule for step 3, if it's not in the repeating table, what are your criteria for deciding which row gets set?

    Is there a particular reason you are formatting the field's actual value to a certain format?  In many cases you can just display the date in a textbox or calculated value box and use the formatting settings on those controls to show it a certain way.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-18-2012 12:55 AM In reply to

    Re: Repeating Tables and Current()

    The datepicker is in the row.

    Regarding the date format; that's what the client wants.

    The format is {ddd, d MMM yyyy} and works fine when I use the QRules FormatDate.  I don't see how I can apply that to a text box.

    This is in the newbie's forum for a reason. :)

  • 05-18-2012 02:52 AM In reply to

    Re: Repeating Tables and Current()

    It appears that that particular format is indeed not available in the control properties dialog.  If thi is a filler form, you can use the formatDate() function in a Calculated Value box, though this doesn't seem to work in browser forms:

    msxsl:format-date(my:field2, "ddd, d MMM yyyy")

    If you do use qRules' FormatDate and the datepicker is in the same row as the field you want to set, you can simply use a rule on the datepicker field to copy the Result field to the formatted date field.  No need for SetValue in this case.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-18-2012 04:51 PM In reply to

    Re: Repeating Tables and Current()

    Ah, the joys of Microsoft products being so patchy.   I did get it to work fine as per your suggestion, but I actually need it to be browser-mode.

    Setting a rule to copy the Result field to the formatted date field does not work.  It only does something when I use a SetValue. Which should be fine, I just need an xPath statement to get to the correct row and field.

    I also note that I can't build a template part with QRules injected.  That would be nice to have.

  • 05-18-2012 05:09 PM In reply to

    Re: Repeating Tables and Current()

    Hi - does the form work in preview (filler) when you copy the resutl to the field? When you say "does not work", I'm assuming you mean that the value doesn't get copied - if it works in preview but not in the browser, the issue may be your postback settings.

    You'd orginally had a concat formula you were using with SetValue:

    concat("SetValue /xpath=/my:myFields/my:TravelDetailItems/my:TravelDetailItem[ insert something here ]/my:TravelDateDisplay /value=", Result)

    Usually, what I've done if the rule is being executed on the change of a node in a repeating group is use the count of the preceding-siblings plus one:

    concat("SetValue /xpath=/my:myFields/my:TravelDetailItems/my:TravelDetailItem[",  count(../preceding-sibling::my:TravelDetailItem) + 1,"]/my:TravelDateDisplay /value=", Result)

    Umm, that count formula is just a guess, of course, it all depends on what field / control the rule is on that is setting the value of the command field.

    Hilary Stoupa

  • 05-18-2012 05:44 PM In reply to

    Re: Repeating Tables and Current()

    Genius!  Thank you Hilary.  That worked first time! 

    Now I just have to do the other 20 date fields on the form.

  • 08-01-2012 07:39 AM In reply to

    Re: Repeating Tables and Current()

     Hi Hilary,

     Greetings of the day :)

    I need your help in fixing 1 issue that i am having with repeating section with a cascading multiselect lookup based on dropdown change value.

    Senario: In my InfoPath 2010 form, i am having a repeating section with two controls. 1. Dropdown, 2: Multiselect lookup. I need to provide cascading functionality between these two. i am using OOB filter that we will get when we bind data connection to a control (multi select loookup). i.e., for multiselect lookup control, i am binding a list where the Title column of that list = value selected in Dropdown. 

    This is working perfectly if i don't have a repeating table. It fails when i  am having this senario in a repeating table. i checked the expression that is there for filter and i saw there is "current()/dropdownvalue" i believe this is to get current row selected value of dropwon. This is working in preview. However fails after publishing to library. It is giving null reference exception.

     Please help me in achieving this task. 

     

    --------------below given are my log entries with the correlation error i receive 

     08/01/2012 20:37:54.28     w3wp.exe (0x21CC)                           0x129C    SharePoint Foundation             Logging Correlation Data          xmnv    Medium      Name=Request (GET:http://aditidt865:101/sites/CRF/_layouts/FormServer.aspx?XsnLocation=http://aditidt865:101/sites/CRF/FormServerTemplates/TestIssueForm.xsn&SaveLocation=http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary&ClientInstalled=true&Source=http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.28     w3wp.exe (0x21CC)                           0x129C    SharePoint Foundation             Logging Correlation Data          xmnv    Medium      Site=/sites/CRF    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.36     w3wp.exe (0x21CC)                           0x129C    InfoPath Forms Services           Runtime - Business Logic          82g6    Warning     Business logic failed due to an exception. (User: SPTEST\spadmin, Form Name: TestIssueForm, IP: , Request: http://aditidt865:101/_layouts/FormServer.aspx?XsnLocation=http://aditidt865:101/sites/CRF/FormServerTemplates/TestIssueForm.xsn&SaveLocation=http://aditidt865:101/sites/CRF/TestDocLibrary&ClientInstalled=true&Source=http://aditidt865:101/sites/CRF/TestDocLibrary/Forms/AllItems.aspx&DefaultItemOpen=1, Form ID: urn:schemas-microsoft-com:office:infopath:TestIssueForm:-myXSD-2012-03-06T05-40-29, Type: Exception, Exception Message: Error occured while populating Sub Areas. Error Message:The Web application at http://lab2-wfe1 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new reque...    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.36*    w3wp.exe (0x21CC)                           0x129C    InfoPath Forms Services           Runtime - Business Logic          82g6    Warning     ...st URL mapping to the intended application.)    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.36     w3wp.exe (0x21CC)                           0x129C    InfoPath Forms Services           Runtime - Business Logic          7tge    Medium      Exception thrown from business logic event listener: System.Exception: Error occured while populating Sub Areas. Error Message:The Web application at http://lab2-wfe1 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.     at TestIssueForm.FormCode.PopulateSubAreas(String _strBussinessID) in C:\Users\sharepointadmin.CRM\Documents\InfoPath Projects\TestIssueForm1\FormCode.cs:line 80     at TestIssueForm.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e) in C:\Users\sharepointadmin.CRM\Documents\InfoPath Projects\TestIssueForm1\FormCode.cs:line 37     at Microsoft.Office.InfoPath.Server.SolutionLifetime.FormEventsHost.<>c__Di...    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.36*    w3wp.exe (0x21CC)                           0x129C    InfoPath Forms Services           Runtime - Business Logic          7tge    Medium      ...splayClass6.<>c__DisplayClassa.<add_Loading>b__3()     at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)     at Microsoft.Office.InfoPath.Server.SolutionLifetime.FormEventsHost.<>c__DisplayClass34.<FireLoadingEvent>b__30()     at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.41     w3wp.exe (0x21CC)                           0x129C    SharePoint Foundation             Runtime                           tkau    Unexpected    System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.Office.InfoPath.Server.SolutionLifetime.ExtensionXsltObject.Current(XsltContext xsltContext, Object[] args, XPathNavigator docContext)     at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)    df6e4761-2959-453d-8fef-82aa375dc47f


    08/01/2012 20:37:54.41     w3wp.exe (0x21CC)                           0x129C    SharePoint Foundation             Monitoring                        b4ly    Medium      Leaving Monitored Scope (Request (GET:http://aditidt865:101/sites/CRF/_layouts/FormServer.aspx?XsnLocation=http://aditidt865:101/sites/CRF/FormServerTemplates/TestIssueForm.xsn&SaveLocation=http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary&ClientInstalled=true&Source=http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)). Execution Time=133.674036832514    df6e4761-2959-453d-8fef-82aa375dc47f

    ---------------

     

    Additional info: I used REST service for this. which worked 100% in dev as expected. However, getting some inconsistent "sate server error" in production server so i skipped it. I cannot use xml file as data source method as i dont know how many rows user will be adding at runtime.

    thank you before hand. 

     

     

    Thank you
    Raj
  • 08-01-2012 08:23 AM In reply to

    Re: Repeating Tables and Current()

    Does your form have custom code?

    Hilary Stoupa

  • 08-02-2012 08:11 AM In reply to

    Re: Repeating Tables and Current()

     Yes. my form has custom code.

    Thank you
    Raj
  • 08-02-2012 08:19 AM In reply to

    Re: Repeating Tables and Current()

     thank you very much for your prompt response.

    Thank you
    Raj
  • 08-02-2012 08:23 AM In reply to

    Re: Repeating Tables and Current()

    The error indicates an issue with your custom code:

    Exception thrown from business logic event listener: System.Exception: Error occured while populating Sub Areas. Error Message:The Web application at http://lab2-wfe1 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application. at TestIssueForm.FormCode.PopulateSubAreas(String _strBussinessID) in C:\Users\sharepointadmin.CRM\Documents\InfoPath Projects\TestIssueForm1\FormCode.cs:line 80 at TestIssueForm.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e) in C:\Users\sharepointadmin.CRM\Documents\InfoPath Projects\TestIssueForm1\FormCode.cs:line 37

    Hilary Stoupa

  • 08-02-2012 12:08 PM In reply to

    Re: Repeating Tables and Current()

    hi hilary, very sorry. this is another issue and i resolved it. the actual issue is still exists. here are the correct logs of that error. If you see in the log's it says null reference exception and at evaludating xpath node iterator. I am trying to give a field's value in a repeating controls to another field (multi select list box)'s filtering condition of items that are coming from a SP list data connection. it works fine in preview.
    ----------------
    
    08/03/2012 01:00:31.91 	w3wp.exe (0x1944)                       	0x264C	SharePoint Foundation         	Runtime                       	
    tkau	Unexpected	System.NullReferenceException: Object reference not set to an instance of an object.    at 
    Microsoft.Office.InfoPath.Server.SolutionLifetime.ExtensionXsltObject.Current(XsltContext xsltContext, Object[] args, XPathNavigator docContext)     
    at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)	96f87142-92f0-40de-a9ca-e2669eaa7d19
    
    
    08/03/2012 01:00:31.77 	w3wp.exe (0x1944)                       	0x264C	SharePoint Foundation         	Logging Correlation Data      	
    xmnv	Medium  	Name=Request (GET:http://aditidt865:101/sites/CRF/_layouts/FormServer.aspx?XsnLocation=http://aditidt865:101/sites/CRF/FormServerTemplates/TestIssueForm.xsn&SaveLocation=
    http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary&ClientInstalled=true&Source=
    http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)	
    96f87142-92f0-40de-a9ca-e2669eaa7d19
    
    
    08/03/2012 01:00:31.80 	w3wp.exe (0x1944)                       	0x264C	SharePoint Foundation         	Logging Correlation Data      	
    xmnv	Medium  	Site=/sites/CRF	96f87142-92f0-40de-a9ca-e2669eaa7d19
    
    
    08/03/2012 01:00:31.91 	w3wp.exe (0x1944)                       	0x264C	SharePoint Foundation         	Runtime                       	
    tkau	Unexpected	System.NullReferenceException: Object reference not set to an instance of an object.    at 
    Microsoft.Office.InfoPath.Server.SolutionLifetime.ExtensionXsltObject.Current(XsltContext xsltContext, Object[] args, XPathNavigator docContext)     at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)	            96f87142-92f0-40de-a9ca-e2669eaa7d19
    
    
    08/03/2012 01:00:31.93 	w3wp.exe (0x1944)                       	0x264C	SharePoint Foundation         	Monitoring                    	
    b4ly	Medium  	Leaving Monitored Scope (Request (GET:http://aditidt865:101/sites/CRF/_layouts/FormServer.aspx?XsnLocation=http://aditidt865:101/sites/CRF/FormServerTemplates/TestIssueForm.xsn&SaveLocation=
    http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary&ClientInstalled=true&Source=
    http%3A%2F%2Faditidt865%3A101%2Fsites%2FCRF%2FTestDocLibrary%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)). Execution Time=
    152.180387345225	                  96f87142-92f0-40de-a9ca-e2669eaa7d19
    ----------------
    										    
    									    
    Thank you
    Raj
  • 08-03-2012 12:25 PM In reply to

    Re: Repeating Tables and Current()

    Hi Hillary, did you get time to look into my issue. appreciate your prompt help in making my issue resolve. very thank full to you.
    Thank you
    Raj
  • 08-03-2012 12:36 PM In reply to

    Re: Repeating Tables and Current()

    I've not run into this before. Have you tried a web search on your error?

    Hilary Stoupa

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