Manager Hierarchy - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Manager Hierarchy

Last post 10-04-2012 06:09 AM by BejeweledOne. 27 replies.
Page 2 of 2 (28 items) < Previous 1 2
Sort Posts: Previous Next
  • 09-30-2012 03:25 PM In reply to

    I think this has become more complex than it needs to be. Why not have two sources for the data? You could have two dropdowns: one for the Samsung Galaxy SIII and one for the Apple Iphone. Then simply hide/show the correct dropdown, according to the selection made in the previous dropdown.

    You are right that if you try to add rows and set their values, then you also need a way to delete those rows before again using Insert/SetValue.

    It can be done, but it just seems like a lot of work.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 10-01-2012 03:53 AM In reply to

    If there were only those 2 items in this list that might be an idea. Our list of supported phones can run anywhere from 8 - 15 phones at any given time. I was just using the iPhone and the Samsung as examples as they were 2 that had multiple color choices. If qrules can't be used to delete the added rows then I will just have to figure something else out.
  • 10-01-2012 10:30 AM In reply to

    qRules has a delete command and can be used to delete rows. Ernesto was not saying that qRules couldn't delete rows, just that given your example it seemed like more work than needed.

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-01-2012 10:34 AM In reply to

    Thanks, I knew it had a delete command, I just didn't know if it would handle this situation where rows are being inserted dynamically and depending on the item chosen it is a different number of rows that would need to be deleted.

    Qrules has already done so much for me, I keep looking for new ways to use it, but I still need assistance with the syntax etc.

  • 10-01-2012 12:32 PM In reply to

    So, in your earlier post, you said:

    Select Samsung Galaxy SIII

    3 rows added to the table

    Change selection to Apple iPhone

    2 more rows added to the table.

    Can you tell me how to use qrules to setup the delete command to delete the rows that were added initially? I already have the rules in place to set the 4 color fields to blank.

    Whatever logic you are using to add more rows to the table - right before that command, you'd use the delete command to delete the existing rows from the table. If this is in a secondary data source, you'd need the /dsname parameter along with the /xpath parameter. Does that make sense? Feel free to attach your form to a reply if you'd like help.

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-02-2012 07:39 AM In reply to

    So what I have are 4 fields that could possibly be populated with a color. These then are inserted into the dropdown list with the condition that the color field is 'not blank'. This I think poses a bit of a problem for the delete, which is why I wasn't sure if it could be done.

    I can see where it would work if someone mistakenly selected an item with x number of colors and then selected the correct item which has x (+) colors, but if they were to mistakenly select an item that had x number of colors and then select the correct item that had X (-) number of colors it would only delete as many rows as were going to be inserted, which could leave 1 or more orphan lines, if I am looking at this correctly.

    If we look at it like this:

    Color One : Condition - Not Blank
    Delete Rule
    Insert Rule

    Color Two: Condition - Not Blank
    Delete Rule
    Insert Rule

    Color Three: Condition - Not Blank
    Delete Rule
    Insert Rule

    Color Four: Condition - Not Blank
    Delete Rule
    Insert Rule

    Employee selects Item X
    Item X - 4 Colors
    4 lines are inserted into the dropdown

    Employee changes selection to Item Y
    Item Y - 2 Colors
    2 Lines will be inserted so ONLY 2 lines will be deleted.

    Am I understanding this correctly?

  • 10-02-2012 07:49 AM In reply to

    The delete command deletes all instances of a repeating element unless you use an XPath filter. I think you are maybe using a counter or something for your insert, but you don't need that for delete. So when they change selection, on the field that is bound to the control where they are changing the selection, run a delete command and it will delete all instances of your "lines"

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-02-2012 07:54 AM In reply to

    Ok, NOW I understand. Thanks for explaining this.
  • 10-03-2012 05:23 AM In reply to

    I did get the basic concept but after pondering it overnight, I have another question. There will always be one color so the default row in the repeating table will always be populated when a selection is made in the Phone list. So if I use the delete command without a filter, will it just delete any 'inserted rows' leaving the default row alone or will it delete the entire table?

    If it deletes the entire table without a filter, how would I format the command to delete rows 2-4?

  • 10-03-2012 07:07 AM In reply to

    Will the "one color" always be the same color? If so, you could use an XPath like this (made up, since I have no idea of what your schema looks like):

    /xpath=Group/Rows/Row[Name != "Black"]

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-03-2012 08:51 AM In reply to

    Unfortunately not. So this might help. Here are the 4 color fields and their rules.

    StrColor 1
    Disable Field
    Set Color Value - No Condition
    Set strColor = strColor 1
    Set Color 2 - StrColor1 is not blank
    Set strColor2 = @ows_Color_x0020_2[strSupportedDevices = @ows_LinkTitle]

    StrColor2
    Disable Field
    Insert Table Row - StrColor2 is not blank
    Set Command = Insert /parent=/my:myFields/my:grpColor /child=my:Color /posn=last /count=1
    Set Command = concat("SetValue /xpath=/my:myFields/my:grpColor/my:Color[2]/my:strColor /value=", .)
    Set Color 3 - StrColor2 is not blank
    Set strColor3 = @ows_Color_x0020_3[strSupportedDevices = @ows_LinkTitle]

    StrColor3
    Disable Field
    Insert Table Row - StrColor3 is not blank
    Set Command = Insert /parent=/my:myFields/my:grpColor /child=my:Color /posn=last /count=1
    Set Command = concat("SetValue /xpath=/my:myFields/my:grpColor/my:Color[3]/my:strColor /value=", .)
    Set Color 4 - strColor3 is not blank
    Set strColor4 = @ows_Color_x0020_4[strSupportedDevices = @ows_LinkTitle]

    StrColor4
    Disable Field
    Insert Table Row - StrColor 4 is not blank
    Set Command = Insert /parent=/my:myFields/my:grpColor /child=my:Color /posn=last /count=1
    Set Command = concat("SetValue /xpath=/my:myFields/my:grpColor/my:Color[4]/my:strColor /value=", .)

    Where would I put the 'Delete' command?

    I did try the delete command. I had it on the strcolor1 field immediately after the original set color value.
    This is the command I used: Command = Delete /xpath=/my:myfields/my:grpcolor/my:color and below is my structure.


  • 10-03-2012 04:54 PM In reply to

    Any chance at all I could get you to share your form? I'm having a really hard time understanding this without seeing the form.

    Or a screenshot of the controls? I just don't get what you are doing at all. I'm sorry.

    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-04-2012 06:09 AM In reply to

    I can't upload the form, it's too large (286k), maybe I could email it?  I am including a put together picture as the form is too large to include a full screenshot.   Here is some additonal information that hopefully helps

    This particular piece of the form is a cascading dropdown setup with the second dropdown being populated by a repeating table where the information in the table is added dynamically based on the selection in the first dropdown.

     The fields that you will be interested in are:

    myfields
        grpNewDevice
          lstSupportedDevices  (The dropdown listing the Cell phone Models)
          lstColor  (The dropdown showing the available colors for the selected phone)
     
       grpMainDebug
          strColor1
          strColor2
          strColor3
          strColor4
     
       grpColor (The repeating table group)
          Color (The repeating group that gets dynamically populated by rules on the color fields)
          strColor  (The field in the repeating table)

    The basic scenario ~ Employee filling out the form selects a phone from the dropdown list.  The second dropdown is populated with the available colors for the phone selected.

    How it is supposed to work ~ The colors and number of colors change based on the item selected in the first list.  So the table that the dropdown list gets its value from is a repeating table that is  populated dynamically by rules on the 4 'color' fields.  There will always be a value in the first field.   The first color field has a 'set field' rule to populate the 2nd color field from the data in the SharePoint list.  This 'strColor2' is where all the 'magic' starts to happen.  If the condition 'Not blank' is met, the rules insert and populate a row into the repeating table and then populate 'strColor3' where this process is repeated and then on to 'strColor4'.

    If the employee filling out the form mistakenly selects the wrong phone from the list and then changes his selection, the corresponding 'lstColor' should only display the available colors for the phone selected.   This means that somewhere a delete has to happen to clear the rows for the repeating table or it just keeps adding rows and if the 2nd selection made has fewer colors associated with it then the first, there will be lingering items from the 1st selection.

    This image shows a selection in the list of phones and it's corresponding list of colors.   The second part of the image shows what happens if a different selection is made of a phone that has fewer colors than the first.    Each part shows the repeating table and what is happening to it when the selection is made.

     

     


Page 2 of 2 (28 items) < Previous 1 2
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.