Problem with qRules Insert Command - InfoPath Dev
in

InfoPath Dev

Qdabra® Active Directory Web Service

Use our Google Custom Search for best site search results.

Problem with qRules Insert Command

Last post 06-23-2011 08:44 AM by Anonymous. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-22-2011 08:11 AM

    Problem with qRules Insert Command

    Hi all,

    I'm having a bit of an issue using the "Insert" command on qRules and having looked through the other posts on the subject haven't encountered anyone else who seems to be having the same problem.

    I've managed to get the insert command to work, although I've found that it will only work if I include both the /posn= and /count= elements in the command; if I leave this off I get the "Failed to insert child node" error.  Both /posn= and /count= also have to be numbers, I can't use the term "last" like in the sample qRules form.  The problem I'm having is that the insert command is always inserting a row/section above the previous one and not below it.  In some cases this hasn't really been an issue but in this particular case it's rather annoying and I'd like to sort it out!

    Here is the command that is being fired on the button click (I've entered it in the value field, not in the fx section):  Insert /parent=/my:ExpenseReport/my:MileageDetails /child=my:Mileage /posn=1 /count=1

    Reading through the other posts I've seen a lot of discussion about /child and it always seems to be written as /child=/my:Mileage however this results is the same "Failed to insert" error...the above is the only way this command seems to work for me!

    Below is the structure of my data souce, I'm trying to use the "insert" command to insert a new my:Mileage row.  Should note that my:Mileage is currently set-up as a repeating section rather than a repeating table but I've tried changing to a repeating table and I still encounter the same issue

    /my:ExpenseReport

         /my:ExpenseReport/my:MileageDetails

              /my:ExpenseReport/my:MileageDetails/my:Mileage

    Any help is appreciated as always!

    Oh yeah, IP 2010 & qRules 3.1

    Filed under: , ,
  • 06-22-2011 08:31 AM In reply to

    Re: Problem with qRules Insert Command

    Hi Ben,

     Could you send a copy of your form to our support alias "support AT qdabra DOT com" so we can have a look?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-22-2011 09:55 PM In reply to

    Re: Problem with qRules Insert Command

    Shouldn't matter if it's repeating section or tableand your child node should be relative, so you're correct there. Not sure why the other posts speak differently. Need to investigate that.

    I use qRules Insert all the time and I don't see it pre-inserting. But you know, qRules does contain the Sort command so you could conceivably add the now() time on insert (via a rule on the repeating section to set a hidden field) and then just reorder the rows using that... crazy workaround, but hey if it works why not ... meanwhile as Jimmy said, please attach your XSN (or a sample) and we will do the deeper dive ...

    Patrick Halstead
    Project Manager at Qdabra
  • 06-23-2011 07:14 AM In reply to

    Re: Problem with qRules Insert Command

    Hi Patrick,

    I'll try the workaround discussed and see if that works...in the meantime I've emailed a copy of my template over (was too large to attach!).

    For the record, I was having other issues with the template so I created a new one from scratch as I thought that using an old (and rather messy) datasource may have been causing the issue.  Still no luck though, Insert command is always inserting a row/section above the previous one!

    Ben

  • 06-23-2011 08:34 AM In reply to

    Re: Problem with qRules Insert Command

    Hello Ben,

     The problem here is with the design of your data source.  For the Insert command to work properly, the repeating node being modified needs to have its own parent, whereas ExpenseItems and Mileage both have sibling nodes that share the same parent nodes as themselves (ExpenseSubTotal, FuelType, etc.).  Giving repeating nodes their own parent also tends to be good schema design in general.

    If it's not too late in the form design process, I would suggest restructuring the data source to remedy this issue.  If that's not possible, a potential workaround is to use a concat formula to specify the position:

     concat('Insert /parent=/my:ExpenseReport/my:MileageDetails /child=my:Mileage /posn=', (count(Mileage) + 1))

    I don't think you should need to use the /count parameter, so please give the command a try without it.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-23-2011 08:44 AM In reply to

    Re: Problem with qRules Insert Command

    Thanks Jimmy, just did a re-jig of the data source and now the insert command works a treat!

    Inserts a new row below the previous one and I don't need the /posn= or /count= paramaters

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