Repeating Section Email [SOLVED] - Two more questions: insert repeating section and autonumbering - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Repeating Section Email [SOLVED] - Two more questions: insert repeating section and autonumbering

Last post 08-27-2007 06:48 AM by nukkumatti. 16 replies.
Page 1 of 2 (17 items) 1 2 Next >
Sort Posts: Previous Next
  • 08-21-2007 06:48 AM

    Repeating Section Email [SOLVED] - Two more questions: insert repeating section and autonumbering

    Hey guys,

    I've got a major problem figuring out how I'm going to accomplish a certain task on my form. I have a repeating section, and within the repeating section is a field called delegateToEmail, as well as a button. Now, I have a dataconnection which emails the address in delegateToEmail. However, it ALWAYS uses the delegateToEmail that's in the first repeating section, which as can be imagined, is a pretty major problem. Is there any way to reference the number of repeating spawns.

     Does anyone have any ideas as to how I can fix this? Really in a jam here...

    Thanks,
    Repole

    EDIT: THE ABOVE HAS BEEN SOLVED, thank you very much to the contributers. I have two more questions now.

    Problem 1: I know it's something that's already been answered here numerous times, however whenever I go through those threads I still end up lost: autonumbering.

    My form has a field referenceID. What I need is to query my database and return the largest reference ID. Now, when I run  XDocument.QueryAdapter.Command = "SELECT referenceID FROM Requests ORDER BY referenceID DESC";
    XDocument.Query();
    The largest reference ID in the database is returned, which is great. However, running a query locks up the rest of the fields.

     http://www.infopathdev.com/forums/p/4467/16871.aspx#16871
    In that thread there's a solution posted, however while this does create unique indexes in the database, the user doesn't see the referenceID. I need the referenceID to be on the form and the user to know the referenceID of the form they're submitting.

     http://www.infopathdev.com/forums/t/4367.aspx?PageIndex=2
    In that thread, while there are some ideas that i've played around with, none seem to solve the problem fully.

    Problem Two: Inserting a repeating section programatically. Again, this has been discussed quite a bit, but I'm still failing to understand a lot of what I've seen. Basically what I want is a button that acts just like the "insert repeating section below." The reason I'm setting things up like this is because the repeating section is initially hidden, and for some reason that text doesn't get hidden in the process. I saw an ExecuteAction and ::Insert thing going on through some googling, however, still a bit lost. Am I on the right track with that?

     

     Problem #1 is the big priority here, the autonumbering is an absolute must. I'd love to solve problem #2, but it's not essential. I'm leaving my job Friday, and I really need to get this finished. I appreciate all the help I've been given so far.

     Thanks 

  • 08-21-2007 11:03 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Hi Repole,

    You can get delegateToEmail value from e.source of that button click.

  • 08-21-2007 11:56 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    I've never used e.source before, and after browsing around the web I'm still confused. When I try using it in my code it tells me e is undefined.

     Can you give me some sort of example (preferably in javascript)  that could demonstrate this? I'm pretty lost, and a bit stressed out since I'm leaving Friday and need to have this done.

     Really appreciate the help.

    EDIT:

    Shouldn't I simply be able to set the xpath of my email be dfs:dataFields/d:Requests/d:furtherTracking[my:count]/@delegateToEmail and have a field my:count that keeps track of how many times a new section has been inserted? I tried inserting this for my xpath, however it gives me an error and converts d:furtherTracking[my:count] to d:furtherTracking/my:count, which isn't right...

  • 08-21-2007 12:07 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    function CTRL1_5::OnClick(eventObj) 
    {
          eventObj.Source; //This will give you the row in which you have clicked your button on.
    }

  • 08-21-2007 12:13 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    ah, eventObj.

     Well, that's useful, but now how do I change the xpath for my email submit? Or would be creating a Email though code be a better way of going about things?

     

    EDIT: silly me, putting quotes around my:count seems to work. Lemme go try that all out...

  • 08-21-2007 02:01 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Welp, still having trouble here. The concept is good, the execution is bad.

    When I try to use an xpath  dfs:dataFields/d:Requests/d:furtherTracking[2]/@delegateToEmail it does use the correct repeating section. However when I put dfs:dataFields/d:Requests/@numReDelegated in place of the 2, and set that to equal 2 to start, it doesn't accomplish the job. The formula only verifies if I put dfs:dataFields/d:Requests/@numReDelegated in quotes.

  • 08-21-2007 09:24 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    You dont need to write full XPath you can just use

    eventObj.Source.selectSingleNode("@delegateToEmail");

    This above line of code will get you the correct email alias that you want.

  • 08-21-2007 11:16 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Hi, please have a look here. It should help you solving you issue: http://www.infopathdev.com/forums/p/5091/19620.aspx#19620
    Listen to Motörhead cos they play Rock'n Roll :)
  • 08-22-2007 11:38 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Thank you very very much Agni Jonnalagadda and nukkumatti. Agni your solution worked, however I decided to take the button out of the repeating section for cosmetic reasons, which of course made the eventObj.Source call not work to the right extent. The thread nukkumatti linked to had what I ultimately was looking for. I really appreciate the help, can't thank you all enough.

     EDIT: I've got a few new problems, the initial post has been updated,

  • 08-22-2007 11:20 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    okay let's get it on. thank god it's friday soon :) . Regarding your second question, this is easy to solve: uncheck the Show Insert Item bla bla bla from the repeating sections properties. drag and drop two buttons into you repeating section. name one "hey dude here you can insert a new section" and one "delete" and create the onClick events so that you can write some code. now in your infopath form in the menu go to files and select "Extract Form Files". Browse to the folder where you extracted the files to and open the manifest file with the notepad. search for the xmlToEdit name of your repeating group, if you have not renamed it, it will be someting like "group2_1". now jump back to your script editor and for your insert button use XDocument.View.ExecuteAction("xCollection::insert","xmlToEditName"). Replace the ::insert with ::remove for the delete button. That's it. Easy once you know the trick. regarding your second question. do you know what the very nice thing about GUIDs is. They save you a lot of brain pain ! With GUIDs you are able to actually sent primary key values into your database from your front end. I don't remember exactly if it is 128bit or 256bit but you are 99.99% on the save side that the same number won't appear twice. Okay the number is a bit hard to read if you really have the need to show it to the user in your form. Otherwise i have a question. What do you mean by the query locks the other controls ? Hope the information is at least a bit helpful. good luck anyway. sorry for the formatting i have some trouble here...
    Listen to Motörhead cos they play Rock'n Roll :)
  • 08-23-2007 05:11 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    The insertion works perfectly, yet again you've come through :)

    As for the ID, it really is a must that the user sees it, because they need to be able to reference it themselves later. What I mean by the other fields locking up is if I run a query through code, it fills in the fields it can, however nothing on the form is editable. It's all locked. I can set my table up to have an autonumber, however the issue there is that the user never sees it. I don't know anything about GUID's, and a quick search doesn't turn up much, how do they work?

  • 08-23-2007 11:20 PM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Okay sorry for the late reply I know it's friday already and you need to get things finished. Night shift I guess :). So at least now I know what you mean. You have a connection to a database table as a secondary datasource and when you run the query it populates your fields in your infopath form but also locks them and you need to have them writeable and also show tha biggest referenceID number. I guess that you draged and droped the fields from your secondary datasource into your form. sorry but then the fields will be always locked as you are not allowed to write any data into that fields (as it would mean change values in the database (if you had the possibility to submit the data), this is only possible if you from the beginning on build your form from a dataconnection to a database.) my proposal is that you use a webservice to solve your problem. please have a look here: http://msdn2.microsoft.com/en-us/library/bb735652(office.11).aspx hope this keeps you going------ also this one here maybe even better http://msdn2.microsoft.com/en-us/library/bb735659(office.11).aspx
    Listen to Motörhead cos they play Rock'n Roll :)
  • 08-24-2007 05:47 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

     Appreciate the response. Only 8 hours left =]

    Inserting the fields was drag and drop, but the form was created from the database, it's not a secondary datasource but rather the main one. What is odd is that when I run the query through code, the fields do lock up, but if I run a query with a button it works just fine and none of the fields get locked up. Why is that and is there anyway other than web services to fix that aside from web services. I don't think I have time to implement web services honestly, because I still have a few other smaller issues I'm fixing.

  • 08-24-2007 09:00 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    Hi Nick,

    We have a free dev edition of our database web service available if you want to give it a try...

    http://www.infopathdev.com/files/folders/dbxldownload/entry22386.aspx

    Let us know if you need help setting it up. Should take <30 minutes.

    Patrick Halstead
    Project Manager at Qdabra
  • 08-24-2007 10:50 AM In reply to

    Re: Repeating Section Email (REALLY need help here)

    I've looked into it earlier, and while I find it incredibly useful and a great tool, my company isn't interested, and quite honestly it's not worth it when I've got one incredibly minor error left to fix. I appreciate the help you lended earlier however, and I wish you luck with the accelerator, because I think it can be an extremely helpful tool.

     On a side note, 3 hours left and I'm still left with this one issue. This has to be overcomable without a webservice, it seems like something that plenty of people would need in their forms.

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