Hi Hilary(Guru)!
Thank you very much for your comments, you did really solve my issue. Never knew that DeleteSelf() would pitch me out the loop. All i did was took away this piece of code, because the next code i wrote was clearing away the rows anyway.
// took this code away
else
{
WriteToDebug("Removing empty attachment");
caseAttachments.Current.DeleteSelf();
}
Thanks again.
Well i still have only one major issue which is a blocker. Hoping to get some advice. Ok here it goes.
The Infopath form that i had created has about 10 different case types. The Problem that i am facing is Auto- numbering each types. For ex . When the starts a new case they have an option to choose the case they wanted to raise .Case ID should look like Case Type+ ID (GEN-000001), and when the user creates another case in GEN the ID should look like (GEN-000002) but instead it is like (GEN-000039) and so on... because i have 10 different case i want all of them to have a sequential order in ID. For ex. when the chooses a different case, say CCF even though it starts with (CCF- 000001) but the very next case will have an all together different ID such as (CCF-000040). How can i have each case types to generate ID's sequentially?
Cant find this type of an issue in any article that i have looked in to.
The following is the calculated value which is in a rule that i use to generate an ID each time i click on a Save Case button. I have a field called CaseCount which gets the ID from a DataConnection the calculated value looks like this
count(ID[contains(_x007b_2a9d2794_x002d_aeb9_x002d_4dcf_x002d_993f_x002d_4303298d5a7c_x007d_, Type)])
Then i created another field called TempCaseId and set its value as concat(my:Details/my:Type, "-", "000001")
I have then created three action rules for the Save Case button
1. Lookup Cases: which queries the data connection
2. Set First Case ID : condition is CaseId is blank and CaseCount 0 which runs the following actions
A) Queries the data connection
B) Sets Fields Value : TempCaseID and its Value as
With Xpath
concat(my:Details/my:Type, "-", substring("000000", 1, (6 - string-length(xdMath:Max(xdXDocument:GetDOM("Case Lookup")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[contains(../d:_x007b_2a9d2794_x002d_aeb9_x002d_4dcf_x002d_993f_x002d_4303298d5a7c_x007d_, xdXDocument:get-DOM()/my:myFields/my:Details/my:Type)]) + 1))), xdMath:Max(xdXDocument:GetDOM("Case Lookup")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[contains(../d:_x007b_2a9d2794_x002d_aeb9_x002d_4dcf_x002d_993f_x002d_4303298d5a7c_x007d_, xdXDocument:get-DOM()/my:myFields/my:Details/my:Type)]) + 1)
Without Xpath
concat(Type, "-", substring("000000", 1, (6 - string-length(max(ID[contains(_x007b_2a9d2794_x002d_aeb9_x002d_4dcf_x002d_993f_x002d_4303298d5a7c_x007d_, Type)]) + 1))), max(ID[contains(_x007b_2a9d2794_x002d_aeb9_x002d_4dcf_x002d_993f_x002d_4303298d5a7c_x007d_, Type)]) + 1)
Not sure what i am doing wrong here. I'll be very grateful if you could help me with this issue.
Many Many Thanks Hilary.