Concatenating two Columns of two views into one computed column in view

Hi all,

I have create a main view using a query which contains three views in it, now in the main view I want to form a computed string column which contains the values from two fields which are from two different datasources of the query.(Hint: In both source column either one of the value will be present at one time), so that i need to union all the values from both the columns into one column. Can anyone Please suggest a solution to bring both values in one computed column please.

Thanks in advance,

I suggest you create a temporary table. Meaning, while looping on those datasources and doing computed string, dump the data in a temporary table.

What problem do you have with the implementation?
If you have no idea how to do it, the first thing you need to do is designing and testing the SQL code doing the calculation. Only when you have this working, start worrying about how to write code in AX generating this piece of SQL code.

Problem solved I achieved it by concatenating two column values by checking columns if null in computed column method, Thanks for replies

Please share your solution with us (other people may have the same question) and then close the thread by marking replies forming the answer.

As I said in the requirement I have two columns which will contain value either one at a time and I m combining both columns into one column which was assigned using the code

#define.ViewName(View1)
#define.DataSourceName(“CustTable_1”)
#define.FieldAccountNum(“FieldName”)
str sReturn,
sStr;
DictView dictView2;

// Construct a DictView object for the present view.
dictView2 = new DictView(tableNum(#ViewName));

// Get a string that has the target field name

sStr = dictView2.computedColumnString
(#DataSourceName,
#FieldAccountNum,
FieldNameGenerationMode::FieldList,
true);

sReturn = “ISNULL(”+ sStr+ “,‘All’)”;

return sReturn;

This code worked for me for my requirement

That’s interesting, because that’s not what your code does. You said it combined (concatenated) two fields, but there is only one field: (CustTable_1.FieldName), which isn’t concatenated with any other field. The code provides a hard-coded default value if the field is NULL.

Yes I compared for a null value in first column if found then replacing it with all and if value is found then insert tha fetched value. This is my code, and my apologies for using the term concatenate snce it was another way through I was trying to attain the output