Quantcast
Channel: Microsoft Dynamics AX
Viewing all articles
Browse latest Browse all 101540

Forum Post: RE: Computed Columns troubleshoot

$
0
0
This is SQL code for you original computed column (assuming a string field of 20 characters): CAST(OPRNUM - OPRID AS NVARCHAR(20)) You have two problems there: You're using minus (-) operator, which doesn't really make sense here, because OprId isn't a number. I assume you wanted to concatenate OprNum and OprId with '-' as a separator, but it's not what you code does. OprNum is an int, therefore you have to convert it to string. You want something like this: CAST(CAST(OPRNUM AS nvarchar(5)) + '-' + OPRID AS NVARCHAR(20)) And this is X++ code generating such T-SQL code: return SysComputedColumn::cast(SysComputedColumn::returnField ( tableStr(TestView), identifierStr(ProdRouteTrans), fieldStr(ProdRouteTrans,OprNum) ), 'nvarchar(5)') +"+ '-' + "+ SysComputedColumn::returnField ( tableStr(TestView), identifierStr(ProdRouteTrans), fieldStr(ProdRouteTrans,OprID) );

Viewing all articles
Browse latest Browse all 101540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>