Welcome to Forums Sign in | Join | Help | Forums
in Search


Running stored queries

Last post 07-07-2006 3:37 PM by Patrick Harris. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-03-2006 11:23 PM

    Running stored queries

    I have a dynamic query created with RE and I want to use the API to pull in the result from this query. The query also has parameters that are needed for 3 "date_changed" fields. First, how do I gain access to results from this query by using the API? Second how do I supply information to the parameters of my stored query? I'm using C++ for this project, but I think I can't convert anything that someone gives me, just give me something...please. Thanks
  • 07-05-2006 8:02 AM In reply to

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Running stored queries

    Here is an example using the VBA environment. I am sure that it should not be too difficult to adapt to C++ Dim oQuery As New CQueryObject Dim oQuerySet As New CQuerySet oQuery.Init REApplication.SessionContext oQuery.LoadByField uf_QUERY_NAME, "test" Set oQuerySet = oQuery.QuerySet oQuerySet.OpenQuerySet Do While Not oQuerySet.EOF MsgBox Format(oQuerySet.fieldValue("First Name")) oQuerySet.MoveNext Loop If Not oQuerySet Is Nothing Then oQuerySet.CloseDown Set oQuerySet = Nothing End If If Not oQuery Is Nothing Then oQuery.CloseDown Set oQuery = Nothing End If However it is not possible to pass the query any parameters. If you try to write an "ask" query you will be prompted for the parameters in the same way as you would if you ran the same query. David Zeidman Development http://www.zeidman.info
    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 07-05-2006 2:08 PM In reply to

    Running stored queries

    So how would you run a query to get all constituents that had some part of the data changed, whether its the name, address, status, standing, etc? Also, what query would you run?
  • 07-06-2006 4:46 AM In reply to

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Running stored queries

    It depends how your application works. If it runs on a regular basis i.e. every day or every week you could have a query with the criteria date last modified and put yesterday or this week as the value. That way you could get all the constituents that had been modified within that time frame. Zeidman Development http://www.zeidman.info
    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 07-07-2006 3:08 AM In reply to

    Running stored queries

    It could be ran any time they need to, but it needs to start from the "last" time that they ran the query. This way no data is ever lost, no matter when they run the query.
  • 07-07-2006 9:07 AM In reply to

    • William Da Silva
    • Top 500 Contributor
    • Posts 36
    • Organization: Centraide Québec
    • Products:  The Financial Edge, The Raiser's Edge

    Running stored queries

    Instead of dates, use flags. On the after save event, add a value to a hidden field (if yu have any). Then in your query, query on this field and not dates. When your script runs through the query, reset the value... Sort of like a posted, not posted kinda thing... William da Silva ---------------- eSimpleIT [Email Removed]
    William da Silva
    eSimpleIT.com
  • 07-07-2006 9:15 AM In reply to

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Running stored queries

    I had never thought about using hidden fields like that previously (I have never been to an organisation that had any fields that have been hidden). The only problem with this is that it will not work with any changed made by Global Change. Now if you knew of a way around that... Zeidman Development http://www.zeidman.info
    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 07-07-2006 9:21 AM In reply to

    • William Da Silva
    • Top 500 Contributor
    • Posts 36
    • Organization: Centraide Québec
    • Products:  The Financial Edge, The Raiser's Edge

    Running stored queries

    I usally try to hid what is not necessary. Often things like Religion or birthplace, maiden name, nick name, marital status... Several orgs don't track this info. As for a global change, you would have to include this flag in your global change, so what ever you are changing, add an "add" to that field. I don't know what the query is for, but perhaps he does not want to include global changes. Just noticed that in the original post, it was mentioned API an C++. I think my solution is more VBA. William da Silva ---------------- eSimpleIT [Email Removed]
    William da Silva
    eSimpleIT.com
  • 07-07-2006 3:37 PM In reply to

    Running stored queries

    I'm not at liberty to make those type of changes to thier system. I have to use what's there. I get the impression that what I need and how I need it can't be done. Thank you for your time.
Page 1 of 1 (9 items)