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 :
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
    303,706 Super User 2026 Season 1 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
    239,029 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans