web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Suggested Answer

String field need to change in Real Field

(0) ShareShare
ReportReport
Posted on by 207

Hey Experts,

Actually , In starting we developed a table which have one string field for putting values example "100 & 200". But some users entered value like" space 100 & space 200". so that's create problem for getting report through Power BI.

So my question is, Their any possibility to change string field to real filed on user interface form level. So user can only enter real value.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    If you want them to enter "100" you need to change field type to real or int on the table. If you want to let them enter "100 & 200" then you need to implement validation on the field and check that string formatted as you like.  

  • Suggested answer
    Khurshid Wali Profile Picture
    928 on at

    Hello Deepaknonu,

    The best way is to change the table field from string to real or int. Ax will handle all the validations for you. If you can't make changes to the table then override the validate method of that field in the form and only allow proper real numbers.

    if the problem is only left-right 'space' override the modified method and use strLtrim and strRtrim to get rid of right and left space.

    regards,

    Khurshid wali

  • DEEPAKNONU Profile Picture
    207 on at

    Thanks ievgen, I appreciate your quick response, Can you please explain little bit more how can I change the field on table because on field properties type is not editable. And  in this field used EDT which is also string.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    You can't change the primitive data type of an existing field. You need to create a new field with a new type. Then change your application code to use the new field. You need also to create a runnable class that will migrate data from your old field to the new field.

    Now you can deploy those changes to test and prod, and run the migration class. In the next  deployment you can remove the old field.

    Do not simply delete your old field and add a new one with the same name, because this would fail in database sync, preventing you from deploying it to test / prod.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    But the correct solution really depends on your full requirement which we don't know. If only numbers should be allowed, use real or int type. If you need to allow alphanumeric characters, use string.

    You can also link your string field to another table where all allowed values can be defined. Examples of such pattern in standard system include customer group, item group, zip code etc.

  • DEEPAKNONU Profile Picture
    207 on at

    thanks, for you response Nikolaos, I need that field act like a real value this field used for enter quantity value only  because sometimes  user give space in before enter the the quantity it create problem.

  • Mea_ Profile Picture
    60,286 on at

    Then add validation to check that only numbers are entered, you can use str2NumOk() function to check that. However, I would recommend to change field type instead.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    You can't do calculations based on string fields, so you should definetely use a numeric data type.

  • Suggested answer
    startax Profile Picture
    1,845 on at

    Hi DEEPAKNONU,

    If you are changing field type str to real or int then you have to change in Form control, Reports also. Also in code if you are used.

    Better create new field and update data in table.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans