Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Scalar valued function

Posted on by 12,070 Super User 2024 Season 1

Hi all

SELECT
[OwnerId] = [QS_CRM_IF].dbo.fn_Order_SalesRepId(OH.SalesOrderId),
[Order-Won] = SUM(TotalAmount)
FROM [QS_MSCRM].dbo.SalesOrder OH WITH (NOLOCK)
WHERE CreatedOn BETWEEN @BegUTCDate AND @EndUTCDate
AND [QS_CRM_IF].dbo.fn_Order_Is10Revenue(OH.SalesOrderId) IN (@Is10Revenue)
AND TotalAmount > 0.00
--AND StateCode <> 2
GROUP BY [QS_CRM_IF].dbo.fn_Order_SalesRepId(OH.SalesOrderId)
) OW ON OW.OwnerId = U.SystemUserId

What is the meaning of this Query.? I do not know. What are these lines?

*This post is locked for comments

  • Suggested answer
    Aiden Kaskela Profile Picture
    Aiden Kaskela 19,692 on at
    RE: Scalar valued function

    Hi,

    I have no idea - that's not a CRM function. It looks like you have a custom database named QS_CRM_IF, and the function is in there.

    Thanks,

     Aiden

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Scalar valued function

    Hi Aiden Kaskela

    What this QS_CRM_IF].dbo.fn_Order_Is10Revenue(OH.SalesOrderId) IN (@Is10Revenue) function does.?

    Thank you

  • Suggested answer
    Aiden Kaskela Profile Picture
    Aiden Kaskela 19,692 on at
    RE: Scalar valued function

    Hi,

    That query is to get you back a list of Owners of orders, and the amount they won, where the order is between two dates.

    The two lines that are highlighted in red are not from CRM - it's calling a out to another database on your SQL server named QS_CRM_IF and executing the functions there.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans