Calling SP in Javascript which accesses a DB View - InfoPath Dev
in

InfoPath Dev

Calling SP in Javascript which accesses a DB View

Last post 04-05-2006 08:09 AM by ek38. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-04-2006 06:23 PM

    • ek38
    • Top 200 Contributor
    • Joined on 02-14-2006
    • Posts 54

    Calling SP in Javascript which accesses a DB View

    A user is going to click on button and get a "Sum" of points earned from a DB table. SQL Server, i.e.

    select sum(pointEarned) as TotalPoints from <table x> where username = user name stored on the form.

    I created a "view" that stores the sum's for every username in the db.

    I added the view as a secondary datasource. all the fields show up in Infopath.

    I created a stored procedure that queries the "View" passing in username as a parameter.

    I have added the fields of the "View" to the form with a "Run Query" button. Behiind the button I wrote Java script code to call the stored procedure passing the username paremeter.

    I expected the results to populate the datafields for the "View" on the form.

    Nothing happened.

    Is this approach even possible? Using a SP, to query a "View" that is linked in as a "Secondary" Datasource?



    Nothing happens when I run it.

  • 04-05-2006 03:27 AM In reply to

    Re: Calling SP in Javascript which accesses a DB View

    Why do you need to use a stored procedure at all? If you just add the DB view that you talked about that has the sums already computed as a secondary data source then you should be able to filter this list on a name value. Are you receiving the list of username/sum pairs into InfoPath? If so, then there is no need for a stored procedure.

    If you need to use a stored procedure for some reason that I do not know, there are several posts on this forum about this. Check out this thread for starters:

    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1863&SearchTerms=output,parameter
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-05-2006 05:24 AM In reply to

    • ek38
    • Top 200 Contributor
    • Joined on 02-14-2006
    • Posts 54

    Re: Calling SP in Javascript which accesses a DB View

    Matt, Thanks for replying. I hope you are right that I don't need the SP. I did read several threads on this site as well as others and couldn't find an answer.

    Anyway, with your suggestion. Yes, the view coming in already has the data I need. How do you filter on a secondary datasource?

    There is a username on the form when it opens. Let's say it is JaneDoe. I want to put a button on the form that filters the secondary datasource (which is a view) by username JaneDoe thus returning the "Sum" total of all her points.
  • 04-05-2006 08:09 AM In reply to

    • ek38
    • Top 200 Contributor
    • Joined on 02-14-2006
    • Posts 54

    Re: Calling SP in Javascript which accesses a DB View

    Matt,

    Thanks for the direction. I did more digging and found other threads that discuss filtering the secondary datasource and we got it to work.

    I'll probably come back to the Stored Procedure at some point, but right now, we are going to just use the Filters.

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