How would I write this in X++?
select
(CATEGORYID + ’ ’ + CATEGORYNAME) as
CatName
from
CATEGORYTABLE
How would I write this in X++?
select
(CATEGORYID + ’ ’ + CATEGORYNAME) as
CatName
from
CATEGORYTABLE
I think you are trying get the categoryId and CategoryName from categoryTable and trying concatinate them.
str catName;
CategoryTable categoryTable;
;
select categoryId,categoryName from categoryTable ;///write your condition here(using - where)
catName = categoryTable.categoryId + " "+categoryTable.categoryName ;
Is this what you are asking?
and also go through the basics of X++ queries.
Where can I find the basic x++ queries?
I’m trying to create a new field on a table that combines those two fields together. Instead of manually keeping those fields up to date, I wanted a method that would dynamically update. Am I going about this the right way? Thank you for your help!
You can find about X++ queries - in the developer documentation given by Microsoft. which you can download from partner/customer source.
Your requirement can achieved in different ways.
One way of doing it override the insert method of the Table - categoryTable
this.catName = this.categoryId + " "+this.categoryName ; //this points to categoryTable.
write this line of code before super() in the insert method.