web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Illegal use of WHERE expression with strReplace

(0) ShareShare
ReportReport
Posted on by 2,050

i want apply this query

select sum(NetAccountingCurrencyAmount),sum(GrossAccountingCurrencyAmount),count(Worker) from payrollPayStatement
    where payrollPayStatement.PayPeriod == payrollPayPeriodRecId
    exists join payrollPayStatementLine where payrollPayStatementLine.PayStatement==payrollPayStatement.RecId
    exists join hcmPosition where hcmPosition.RecId==payrollPayStatementLine.Position
    && strReplace(hcmPosition.PositionId, "-", "") like dimensionFinancialTag.Value;

but i getting this error 

the problem is this field (hcmPosition.PositionId) content -

and i want compare it without -

 

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at
    [deleted]
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    So you have Positions, and Dimensions which resemble each other but are not really related?

    Could you please share some example values of both?

    Perhaps there's some other approach to the problem, but only such person who knows more details could know.

    But, based on only the details that you wanted to share so far, you need to first convert dimensionFinancialTag.Value into a string that you can use as criteria for HcmPosition.PositionId.

    Something like this (please treat it as an illustrative example - your responsibility is to apply this approach to your exact situation):

    HcmPositionId positionIdCriteria = strIns(dimensionFinancialTag.Value, '-', 3);
    
    select sum(NetAccountingCurrencyAmount),sum(GrossAccountingCurrencyAmount),count(Worker) from payrollPayStatement
        where payrollPayStatement.PayPeriod == payrollPayPeriodRecId
        exists join payrollPayStatementLine where payrollPayStatementLine.PayStatement==payrollPayStatement.RecId
        exists join hcmPosition where hcmPosition.RecId==payrollPayStatementLine.Position
        && hcmPosition.PositionId like positionIdCriteria;

  • mohammed.mqi Profile Picture
    2,050 on at

    thanks for replay

    as you see here

    dimensionFinancialTag.value

    tag.JPG

    and here what i want to compare 

    postin.JPG

    i try as you said before but not working

  • mohammed.mqi Profile Picture
    2,050 on at

    it's still show me empty any idea how to solve this?

  • ToddB Profile Picture
    Microsoft Employee on at

    Hi Mohammed,

    Have you been able to select the first 8 characters of the PositionID; and then remove the '-' ?

    So 'SCR-BU01' would become 'SCRBU01'.

    And then use that to compare with the dimensionFinancialTag.value.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 657

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 615 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 356

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans