Thursday, March 29, 2012

How to manage Serial No. in form library in SharePoint

In SharePoint, form library is based on infopath form, when you submit the form in library, you have to required unique name or number. If you want that your form name is a sequence serial number then follow these steps.
  1. Add a field in your data source name as SNo.
  2. Create data connection to get Max value of ID from library, ID is a default value of any SharePoint library.
  3. Now add a rule of submit button and set field's value SNo = max(@ID) + 1.
  4. Remember, before set the value, you must retrieve the latest value of ID by using Query using a data connection.
  5. Here, one thing is very critical when you submit the form in library initially (means first time), you will get NaN value in ID. So, in this scenario, Point No. 3 will not work properly.
  6. To avoid this kind of issue, please follow the below steps.
  7. Open properties box of SNo. then goto Rules and Merge Tab.
  8. Then Add Rule, Set Condition and Set value.
    • Rule name can anything that you want.
    • Set Condition should be SNo = NaN.
    • Set Value should be SNo = 1.
  9. Now create data connection for submit the form and assign SNo in file name field.
  10. Good Luck guys :))) 

      Thursday, March 22, 2012

      How to clear infopath template cache

      Why we need to clear infopath template cache ?

      Basically sometime new changes in infopath template is not reflect on production environment after publishing the template, the reason is infopath cache. Your new template has successfully published on server machine, so don't need to worry about that. You need to remove / clear infopath cache from user machine(s) only.

      Just open RUN and type infopath/cache clearall then press OK button.

      Now you can open your infopath form and can see new changes in it.


      How to clear all data in repeating table with rule in infopath 2007

      Repeating Table Structure
      Your repeating table structure looks like an right image, suppose you want to clear all data from "JobHistoryRow" on button click with rule. If you apply simple rule for that, you will get warning message.
      Now move to the solution. You need to add one group field and one string field in your data source by using Add a Field or Group link. Suppose group field name is "group1" and string field name is "age". Now open the rule window, click on "Add Action" button, action should be "Set a field's value". This action will take 2 parameters one is Field and second is Value. You will set Field is equal to "age" and Value is equal to "group1", save the rule and close your manifest file.

      Now open your manifest file in "XML Editor" and search your that rule by name, suppose your rule name is "Clear Repeating Table". You will see "targetField=my:age", here we need to change "my:age" with "my:JobHistorySection/my:JobHistory/my:JobHistoryRow", save the form and close.

      Now please open your manifest file in designer and open the rule "Clear Repeating Table", you will see the changes in it. Now time to publish the form and check the rule. It's working fine in my case.