Getting Unique Number From DB Table via DBXL - InfoPath Dev
in

InfoPath Dev

Getting Unique Number From DB Table via DBXL

Last post 03-01-2013 09:00 AM by RobSil1976. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-26-2013 12:42 PM

    Getting Unique Number From DB Table via DBXL

    Greetings all,

     I am now 25 minutes into my learning for Infopath/DBXL and am starting to put some effort into designing my first form.  My goal is to figure out a way to pre-populate a read-only field with an "ID" number and have that ID number guaranteed to be unique for the form and also (preferably) to be selected from a range based upon username.  So babysteps first... how to get a form with a unique number from my DB Table?

     If I understand what i am reading correctly, I can use a straight to DB connection to mimic form to a table-row, but for anything more complex (e.g. multiple tables on 1 form, updates after the fact, workflow, etc.) it may be easier to use DBXL webservices.  Looking for someone that can jump start my VERY limited knowledge on how to do this?

    Example of a student sick leave form that looks like:

     "Student Sick Leave Form"  

         "Request ID: 41534"  <--- guaranteed unique request ID and my PK in my "SickLeave" table.
       "Student Name: <blank to start>Joe Smith"
    "Teacher Name: <blank to start>Mr. Jones"
    "Absence Reason: <blank to start>Flu"

      

    DB Server: MYDBSERVER
    DB Name: AcademicForms (e.g.)
    Table Name: SickLeaveFormRequests (e.g.)
    Table Structure:  <Req_ID>|<StuID>|<StuName>|<TeachID>|<TeachName>|<AbsenceReason>|<AbsenceDate>

     How would I go about structuring this?  Do I need to create a complex query with table-locks to make sure the ID is always unique? Do I have to configure my DBXL web service as a datasource to point to the table in a particular way?  Hoping someone can help me out with pointing me in the right direction so I don't spend too much time going down the wrong path.

    Thx,

    Rob

  • 02-27-2013 07:05 AM In reply to

    Re: Getting Unique Number From DB Table via DBXL

    Hi-

    I have moved the question to the DBXL product forum.

    DBXL maps data to SQL, and this mapping requires a unique key. Perhaps you have a unique ID in your data and can use that, or you can let DBXL assign one (such as the DocID) or you can let SQL assign one (such as an auto increment primary key).

    Our free DBXL training modules go thru these options. The videos are all here:

    http://www.youtube.com/playlist?list=PLUFfSqJwJ1hmlPdC3XoX2YOhBABLlXDIE&feature=view_all

    And the step-by-step training labs are available here:

    http://www.infopathdev.com/files/folders/dbxl/default.aspx

    Hope these help!

    If you're more interested in database-bound forms, Microsoft might have some introductory tutorials, since it's an out of the box feature in InfoPath.

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


  • 02-28-2013 05:53 AM In reply to

    Re: Getting Unique Number From DB Table via DBXL

    Thanks Ernesto.

    Still learning but I am close to solving this.  What I did was create a lookup table in SQL that keeps track of the "Current" index number for the Request ID.  Then I created a Stored Procedure on SQL Server that queries that table, increments by 1 and creates the base "AbsenceRequest" row using that Request ID and then returns the request ID.  In my InfoPath OnLoad I have figured out how to set the fields value, and am just working on querying the stored procedure.  Found a blog of two that talks to it, just working through some bugs.  Will post some code soon.

     Thx,

    Rob 

  • 03-01-2013 09:00 AM In reply to

    Re: Getting Unique Number From DB Table via DBXL

    Figured it out.  See here for an answer:

    http://www.infopathdev.com/forums/p/25249/87602.aspx#87602

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