incrementing a unqiue id - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

incrementing a unqiue id

Last post 10-26-2006 02:02 AM by spudy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-19-2006 09:51 AM

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    incrementing a unqiue id

    I have a requirement to addd a unique identifier with each new repeating group added. The way I am trying to do this is as follows:


    var uidIncrementor = XDocument.DOM.selectSingleNode("//my:aspectUniqueID").nodeTypedValue;
    uidIncrementor = uidIncrementor + 1;
    XDocument.DOM.selectSingleNode("//my:aspectUniqueID").nodeTypedValue = uidIncrementor;

    The aspectUniqueID field is an integer and I was rather hoping that the uidIncrementor would be recognized as such. But rather than adding the two integers it is creating a sting with both values in using concat. Something simple here I need to do just can't figure it out. Any guidance would be great.

    Thanks
  • 10-20-2006 02:46 AM In reply to

    Re: incrementing a unqiue id

    Hi Spudy,

    Is it a unique identifier for each new repeating group or for each new row in a repeating group?

    Assuming that its the latter...
    To have a serial number for each row in a repeating group,there is a tutorial on "How to assign an Autogenerated number to a repeating field" in the following link.

    http://www.infopathdev.com/howto/tutorials/default.aspx?i=d663d7df90e94e65abb02632966e8127

    Regards,
    Abhishek
  • 10-23-2006 03:52 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: incrementing a unqiue id

    Thankyou for the response.

    I was looking for a way to create a unqiue ID that could be assigned to a row that would remain fixed so that I could reference the rows and filter according on this unique ID.
    If any row is deleted, the row number is never reused.

    I have managed to do this by creating a field outside of the repeating group. Using a rule the number is incremented when new row is inserted. This value is then assigned to the a field in the new row.

    I am now looking to take this a step further. When looking through the contents of a building, there are four walls in one given room.

    Using a master/detail repeating table each room is added as an item in the repeating table with the UID assigned. Nested within the detail section there is another repeating group for walls. For each wall in the room the details, type & condition need to be recorded. These are added to the repeating group but need to have a reference to the unique ID of the wall to enable filtering in a different view.

    room:(repeating group)
    --type
    --condition
    -- unique ID
    wall (repeating group)
    --type
    --condition
    --room unique ID

    How do I get the unqiue ID of the room and assigned this value to the new row created for wall repeating table.

    I have tried current()/my:roomunqiueID
    I have checked the xpath expression and no errors are returned but it does nothing. Other actions on the same condition are functioning.

    Any ideas? Do I make any sense?

    thanks
  • 10-24-2006 06:18 AM In reply to

    Re: incrementing a unqiue id

    To set the value of the roomUniqueID in the wall group, use a default value formula like this:

    ../../my:uniqueID

    No need for current(). Also, another idea on generating unique IDs is to use a GUID for each one. You can use up to a quintillion before getting to a 50% chance of a collision.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 10-25-2006 03:15 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: incrementing a unqiue id

    Excellent, thankyou Matt - now when I look at it that makes perfect sense.
  • 10-26-2006 02:02 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: incrementing a unqiue id

    I have several repeating groups which all have a field with a unqiue identifier. These are displayed as master/detail controls. Imagine these relate to different aspects of a room such as window, walls, ceiling, floor etc.

    I have another master/detail control that needs to sit inside each of the detail sections of the afore mentioned controls. Imagine that these relate to work that needs to be performed to correct faults found. I want all of the work required to be stored in a repeating group that is not nested within the indivdual groups they relate to but has a reference to them.

    ceiling - ceilingtype
    - ceilinguID
    - workrequired
    -work
    -workrequiredID
    wall - walltype
    - walluID
    - workrequired
    -work
    -workrequiredID

    floor - floortype
    - flooruID
    - workrequired
    - work
    - workrequiredID

    I have created the sharedgroup on the same level as the ceiling, wall and floor as it is not unique to either of these groups.

    The first issue is a information message showing on the sharedgroup when placed inside the detail view of the other groups:

    "the selected control cannot repeat here because the field to which it is bound is not part of the correct group. The field must be part of the group to which the repeating control is bound."

    This does not seem to cause any issue with functionality, although it causes me to wonder that there must be a correct way to achieve this.

    My other issue is, once creating a new item in the nested master repeating control I want to pick up the walluID or ceilinguID or flooruID of the currently selected control and store it as the workrequiredID. This is proving difficult.

    Can you shed any light on how I should be doing this?

    Many thanks in advance for help!
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.