Announcements
No record found.
Hi,
how to write a X++ job to get the first value for a unique name. ?
ie for frank i need to get 1 and for sam i need to get 2 as output
*This post is locked for comments
There is extensive documentation on select queries. Here is one to look at.
https://msdn.microsoft.com/en-us/library/aa848113.aspx
What do you mean by first value? the one which you have created first? You can think of using keyword firstonly and also order by recid. But first clear the requirement here.
I think you mean this.
static void Job48(Args _args){ Table33 tableGroup,table33; ; while select tableGroup group by Name { select firstOnly table33 order by table33.RecId where table33.Name == tableGroup.Name; info(strFmt("%1",table33.Number)); }}
Hi ,
try this code
static void Job212(Args _args)
{
Table33 table1,table2;
while select Name from table1 group by table1.Name
select firstOnly number from table2
where table2.Name == table1.Name;
info(strfmt('%1-%2',table1.Name,table2.Number));
}
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Basit 1
GL-01081504-0 1
Roya 1