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 :
Microsoft Dynamics AX (Archived)

Syntax Err:9999

(0) ShareShare
ReportReport
Posted on by

When I try to create a method using Martin Dráb's code below, I get Syntax Err:9999 on Line 1 Class Declaration

public static TmpSysQuery rangesToTable(Query _query)
{
QueryBuildDataSource qbds;
QueryBuildRange queryBuildRange;
TmpSysQuery tmpSysQuery;
LabelType tableLabel;
int occurrence;
int dataSourceNo;
int i;

if (!_query)
{
return tmpSysQuery;
}

for (dataSourceNo = 1; dataSourceNo <= _query.dataSourceCount(); dataSourceNo++)
{
qbds = _query.dataSourceNo(dataSourceNo);
if (qbds.enabled())
{
occurrence = SysQuery::tableOccurrence(_query, qbds.table(), dataSourceNo);
tableLabel = tableId2pname(qbds.table()) + SysQuery::tableOccurrenceText(occurrence);

for (i = 1; i <= qbds.rangeCount(); i++)
{
queryBuildRange = qbds.range(i);

if (queryBuildRange.value() && queryBuildRange.status() != RangeStatus::Hidden)
{
tmpSysQuery.clear();
tmpSysQuery.DataSourceNo = qbds.uniqueId();
tmpSysQuery.TableLabel = tableLabel;
tmpSysQuery.FieldLabel = fieldId2pname(qbds.table(), queryBuildRange.field());
tmpSysQuery.RangeValue = queryBuildRange.value();
tmpSysQuery.insert();
}
}
}
}

return tmpSysQuery;
}

The TmpSysQuery table is present in my system.  It seems to be failing on the variable name "_query"?!?

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi Spica,

    Where did you find this code? What methods are on your class? What is the contents on the class declaration method? Is a certain part of the code red-underlined after compilation?

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If the error is in ClassDeclaration, why are you showing code of rangesToTable() method? Aren't you intentionally trying to replace ClassDeclaration with your code?

  • Karen Tabatini Profile Picture
    20 on at

    Hi Spica,

    I just copy your code in a new class and compile this. I got no errors.

    Can you show us the full error mensage?

  • Community Member Profile Picture
    on at

    I was not intentionally doing it.  Thank you very much for your observation!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans