SQL version of Example - InfoPath Dev
in

InfoPath Dev

SQL version of Example

Last post 05-20-2005 03:38 PM by Patrick Halstead. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-12-2005 11:40 AM

    SQL version of Example

    I'm trying to use the "Populating Table Row After Selection" but instead using SQL rather then just static files. As I understand it, how this is done is by rules.

    I believe I have duplicated the rules, but I can't seem to get the expression or text boxes (I have tried both) to update.

    This is an order form and I have a drop-down list with model numbers. I want the rule to figure out that once a model number is selected, it updates a field with it's current price. As it stands right now, I believe that the textbox or expression field just isn't getting the updated data. How would I go about to solve this issue?
  • 05-13-2005 11:24 AM In reply to

    Hi Sainzmichael,
    You could use an OnAfterChange event handler to call SQL directly and update the current price field when the model number changes. Can you provide the code you are using that isn't working (or the rule) and some description of the schema?
    Thanks

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 05-16-2005 09:25 AM In reply to

    quote:
    Originally posted by Patrick Halstead

    Hi Sainzmichael,
    You could use an OnAfterChange event handler to call SQL directly and update the current price field when the model number changes. Can you provide the code you are using that isn't working (or the rule) and some description of the schema?
    Thanks

    Patrick Halstead [InfoPath MVP]
    InfoPathDev



    Thanks Pat for the reply.

    I have a table called OrderDetails for each line item. It is the child of a table called Orders which is all in SQL and is the Main Data Connection. In OrderDetails there is an atribute field called UnitPrice. In my form there is a drop down box that gets its list from a secondary data source called Products, also a table in SQL. Products has all the prices and model numbers (the way we reference and locate product) in it. The drop down list gets its list from the secondary source, but stores the data in OrderDetails in a atribute called ProductID.

    From what I have said above in previous posts, I am trying to get it so that when the product is selected from the drop down list, it will populate a textbox with the correct price. I would like to try to do this with rules, but if not, code will have to do...i'm just learning scripting so if you point me in the right direction, I'm sure I could figure it out ;)

    Thanks for the help Pat!
    (Your book is AwEsOmE!)
  • 05-16-2005 06:34 PM In reply to

    OK, so double click on the first dropdown box. Select Rules. Choose a name (for example, "Lookup"). Add an action to query a data connection and specify your data connection. To do filtering, you'll want to look at adding a second action to set the field based on an xpath filtering of the data that was queried in the first action. XPath can be tricky, but there is a good section on filtering in Chapter 3 (or 4 - I forget since Vani wrote it ... :) .

    Good luck!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 05-17-2005 12:16 PM In reply to

    quote:
    Originally posted by Patrick Halstead

    OK, so double click on the first dropdown box. Select Rules. Choose a name (for example, "Lookup"). Add an action to query a data connection and specify your data connection. To do filtering, you'll want to look at adding a second action to set the field based on an xpath filtering of the data that was queried in the first action. XPath can be tricky, but there is a good section on filtering in Chapter 3 (or 4 - I forget since Vani wrote it ... :) .

    Good luck!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev



    Ok Pat,
    I have a question regarding how Infopath works on the inside. I believe I have my rules set up correctly. I have a rule on the drop down box where it first queries the table of Products, and then another rule where it sets the field of @UnitPrice, which has a text box linked to it....

    Heh...you know what...it started working while I was writing this reply out. Don't know how it is working, but i'll report back once I understand it. I like to know how things work...heh.

    Thanks for the help Pat!
  • 05-17-2005 04:00 PM In reply to

    Well it seems my joy is short lived. I am able to lookup the price for one line item, but when I try and do a second line item, I select my product and it returns the same price as the first line item. It's like during the second line item selection it doesn't go through the rules again. I would think that every time someone uses the drop-down menu where the rules are applied, the rules run again. Am I just gonna have to hunker down and do it through VB.NET?

    Update: I have been told that I need to use current() in my filter to select the current node in the repeating table. I will share my findings.
  • 05-20-2005 03:38 PM In reply to

    you can do this with xpath, but it's a bit tricky. There was an interesting post on Microsoft's blog in March or April of 2004. I also found:http://blogs.msdn.com/infopath/archive/2004/09/13/228881.aspx

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.