Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

SL 7.0 HardCode Example using SGroupFetch1

Posted on by 65
Does anybody have an example using

SGroupFetch1

 I trying these, and get no value

sSQL = "SELECT COUNT(*) FROM X_Table"

Call sql(iCSR, sSQL)

iRV = SGroupFetch1(iCSR, bX_Table)

Call SqlFree(iCSR)

*This post is locked for comments

  • ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: SL 7.0 HardCode Example using SGroupFetch1

    Hi,

       I have same problem buffer size it does not enough, you are saying bcount * 10 but bcount is integer..

    how can you do that?please can you help me?

  • Rob Garcia Profile Picture
    Rob Garcia 65 on at
    Re: Re: Re: SL 7.0 HardCode Example using SGroupFetch1

    Paul,

    I used your example and worked ok.

    Then i tried these:

    Dim sSQL As String, iCSR As Integer, lCount As Integer, iRV As Integer

    sSQL = "SELECT COUNT(*) FROM X_Table"

    Call sql(iCSR, sSQL)

    iRV = SGroupFetch1(iCSR, lCount)

    Call SqlFree(iCSR)

    And works ok too, The problem seems to be the short variables.

    Thanks again.

     By other hand, you said that sometimes the buffer sizes is doesn't enough, what i'm do is these:

    bCount * 10.

     Greetings,

    Rob

  • Rob Garcia Profile Picture
    Rob Garcia 65 on at
    Re: Re: SL 7.0 HardCode Example using SGroupFetch1

    Thanks Paul,

     Your help was very useful, i'm on 7.0 version

    Thanks

    Rob

     

  • Paul Phillips Profile Picture
    Paul Phillips 590 on at
    Re: SL 7.0 HardCode Example using SGroupFetch1

    Hi Rob,

    You didn't mention which version you are on, but here is an example I have used on version 7.0. I haven't tested it on prior versions. I did have some issues with the SGroupFetch call throwing an error 10202 (The application fetch buffer size is less than the cursor select statement requires).

    Here is the example I used. A few things to note:

    • I didn't use a SQLCursor or SQLCursorEx call to initialize the cursor beforehand - that was causing issues for some reason.
    • Also note that you can pass in primitive types instead of a full buffer variable if you are only retrieving a single value from the SELECT statement - a big time saver. I'm not sure if these points are valid prior to v7.0 (you could check the VBTools libraries that wrap the SL kernel to see if they are accepting primitive types in prior versions).
    • The buffer data type byte length is important - don't use a short for the buffer value to hold the COUNT result. The SDK docs have more details on the byte lengths for the various aggregate operations.

    Dim bCount As Integer

    Dim CSR_PJPROJ As Integer

    Call sql(CSR_PJPROJ, "SELECT COUNT(project) FROM PJPROJ WHERE project=’abc’")serr1 = SGroupFetch1(CSR_PJPROJ, bCount)

    Hope this helps,
    Paul Phillips

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans