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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

In x++ sum of String value.

(0) ShareShare
ReportReport
Posted on by 1,215

Hi guys,

i have a list of  itqan number record, now i want to get sum of itqan number but it is that a string field how to get in x++ sum of string field.

give us an alternative way.

thanks.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can't perform mathematical calculations on strings, only on numbers. As you can imagine, calculating "apple" + "blue" would not make any sense.

    So, you must first convert the string to a number (int or real) and then do your calculation.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thank you quickly for the response,

    i already know it is not possible but in my itqan number Like : 1007 to 4447.

    anyway i will try to convert.  

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Sorry for my bad knowledge, but can you explain a bit what these itqan numbers are? I tried to google "what is itqan number" but could not find any information.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Even if i convert to a str2real then how to do the select queries give us a small example.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You need to store them in numeric format in the database in order to use them in select / sum database operations.

    So, if your user inputs a string in a table field and you want to treat it as a number later on, you need to convert it when the record is inserted/updated and store it in a numeric field in your table.

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    You can't use X++ functions is SQL queries. You'd have to fetch what you have in DB (= strings), iterate records, convert values to numbers and summarize the values in the application layer.

    You could also create a view with a computed column doing the conversion and then sum this view.

    But I don't recommend either - the actual problem is in your data model. When you use a correct data type in your data model, summarize the values will become trivial.

  • Verified answer
    qianwang Profile Picture
    7,168 on at

    Hi Riyas,

    Is itqan numbe a fixed format?

    Could you use strreplace("1007 to 4447.", "to", ",") to change the format?

    Hope this helps.

    regards,

    QianQW

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans