Any Idea how to accomplish this task? - InfoPath Dev
in

InfoPath Dev

Any Idea how to accomplish this task?

Last post 12-14-2011 10:46 AM by paulywog. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-13-2011 07:37 PM

    Any Idea how to accomplish this task?

    I am definitely new to InfoPath, but I am a .Net software developer.  What I am finding is that, what I thought would be extremely simple in InfoPath, is turning out to be impossible for someone new to this.

    All I am trying to do is this scenario:

    1. User opens a Form

    2. Form determines if user has a record in a table in the database using their Username (obtained from UserName function)

    2a. If they DO NOT have a record, open a section in INSERTION mode and set some basic default values.

    2b. If they DO have a record, open that record for edit.

    The user can't have more than one record. The table is created already in SQL Server. The table has 3 columns: User ID, UpdateDate, and YesNo, all are text for simplicity. User ID us unique.

    I have already spent 10 hours trying to use the form and the open rules, view, etc. to do this, and I simply can't figure it out.  If anyone has some basic advice, I would love to hear it.  Can you even do this?  Do I have to use VB script and crawl through XML for this? 

    Thanks so much!!  I would think this is simple, but I just can't make any progress. 

     Paul

  • 12-14-2011 10:46 AM In reply to

    Re: Any Idea how to accomplish this task?

    For what it is worth, I wanted to mention one approach I tried, which seemed feasible, but I couldn't get it to work.

    I created a new form, based off a data connection.  I added the primary key field onto the query part of the screen, and then added all three fields into the data fields portion of the screen.  I created a rule at form opening that did this:

    • Set the primary key equal to the username of the person logged in.
    • Query the main data source
    • Check for the datafields to be non present
    • if the datafields are present, stop processing rules.
    • if the datafields are non-present:
    •      Set the data fields to some default values
    •      Submit the data fields using the main data source

    This seemed like it would at least get me started in the right direction, but instead I get that error "The form does not contain any new data to submit to the data source."

     Seems like it would contain data, since I just set the values in the rule. I know the flow is working, because I inserted test records, and then tried again without test data.

    Another question that I have is this. After the query part of the opening rule, the datafields are not present on the screen, because the data returned no rows. Is there no rule that I can use to re-insert the blank row so I can automate the SUBMIT to main connection???

    so confused.  Thanks so much for any advice at all.

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