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

Notifications

Announcements

No record found.

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,162 Moderator on at
    [deleted]
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans