Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Range Where not working

(0) ShareShare
ReportReport
Posted on by 185

Hi

I have written the following range on RM_OPEN

range clear RM_OPEN;

range table RM_OPEN where physicalname('Document Number' of table RM_OPEN)
+ CH_SPACE + "IN" + "(" + CH_SPACE + "SELECT" + CH_SPACE + physicalname('Apply To Document Number' of table RM_Applied_OPEN)
+ CH_SPACE + "FROM" + CH_SPACE + physicalname(table RM_Applied_OPEN)
+ CH_SPACE + "WHERE" + CH_SPACE + physicalname('Apply From Document Number' of table RM_Applied_OPEN)
+ CH_SPACE + "=" + s_document_number + ")";

warning string(countrecords(table RM_OPEN));

fill window 'Scrolling_Window' table RM_OPEN;

I am trying to achieve this SQL query in dex

select * from RM20101 WHERE DOCNUMBR IN(SELECT APTODCNM FROM RM20201 WHERE APFRDCNM = 'PYMNT000000000080')

this receipt(PYMNT000000000080) has 10 records in rm20201

I am getting following error 
   "A countrecords operation on table 'RM_OPEN' cannot find the table.

Anyone Suggest whats wrong with this range??

OR 

How can i write this in  Pass through SQL???

*This post is locked for comments

  • Mohammed Irfan Profile Picture
    185 on at
    RE: Range Where not working

    Siddhartha ,

    I have followed the doc and the range is working now,

    Almas I guess we should write TABLE name ex. RM20101 as [DATABASE].[dbo].[RM20101], which can be done by inserting the following code in range statement before table nam

    'Intercompany ID' of globals + CH_PERIOD + SQL_DEFAULT_OWNER  + CH_PERIOD

    Thanks Siddhartha and Almas, Appreciate your suggestions.

  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at
    RE: Range Where not working

    It's a good example what Siddhartha shared, you can see that how customer master is  subquery by using where clause.

  • Verified answer
    Siddhartha Challa Profile Picture
    92 on at
  • Suggested answer
    Almas Mahfooz Profile Picture
    11,009 User Group Leader on at
    RE: Range Where not working

    Irfan ,

    Rang can work on single table at a time. so your code will never work like that.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans