Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

How to Concatinate multiple Form Control values into one new Control in the same Form.

Posted on by 345

Hi -

  I have a form with multiple fields and display methods. I need to add a new control on the form which will display the concatenated value from other controls in the same form. Is this possible to do ?

for example

Capture22.JPG

I have a Control Account, Name and Dob. The new control is empty for now.  Is it possible that I can use the values from Account Name and Dob control and concatenate them and display it in my new Control something like this ?

63002.Capture.JPG

Thank You

*This post is locked for comments

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    Also you might create a view and use it as the datasource.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    Setting the control with AutoDeclaration = Yes and putting its control from code won't work if the control is a column in grid and therefore it has many different values (one for each record in the grid).

    You might want to populate a temporary table with all your calculated values and simply using this temporary table as the datasource.

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    True but how can I do that ? I tried doing this but all the records on my form are displaying the same value from the first record in the form. I mean it only works for the first row of the form and then it repeat the same value from the first row record to all the other records in the forms grid. 

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    Yes, you can try, of course. But any way, calling value from another control also will call logic from control's display method.

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    ok that is an option I agree but I was thinking maybe if I can set the Auto Declaration property of a control to yes and use the value of that control on another control in the same form ? I need to know if this is possible ?

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    To get values from another table or display methods you should get the records of another table which depends from first table and call logic from another display methods to get the values. And keep in mind what this will affect performance.

    Maybe the best way is to create a field on the table and fill it?

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    Just to clarify the values I'm trying to concatenate are through other display methods. These values are not present in a table(Data source). I have two display methods on two different controls which are getting the values for them. Now I need to concatenate these two values in a new control altogether. I hope I'm making sense.

    Thanks

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    is it possible for me to use Multiple datasource tables on this method ?

    Because I have multiple Datasources on my form. And the values I need to concatenate are from 2 different data sources

    for example

    display str getConcatinatedValue(YourDSTable1 , YourDSTable2 )

    {

       return strFmt("%1 %2", _yourDSTable1.Field1, _yourDSTable2.Field2);

    }

    Thank You

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    Create display method on form's DS and set this method as DataMethod property on your form control, also set DataSource property on your form control. 

    As example:

    display str getConcatinatedValue(YourDSTable _yourDSTable = YourDSTable)
    {
        return strFmt("%1 %2", _yourDSTable.Field1, _yourDSTable.Field2);
    }


  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: How to Concatinate multiple Form Control values into one new Control in the same Form.

    It is just a form Control. Now I need to add a value to this control by concatenating the values from the other controls which are already on the form.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans