Dynamics AX
  RSS Feed  LinkedIn  Twitter
Want to turn you're data into a true asset? Ready to break free from the report factory?
Ready to gain true insights that are action focused for truly data informed decisions?
Want to do all of this across mutliple companies, instances of Dynamics and your other investments?
Hillstar Business Intelligence is the answer then! (www.HillstarBI.com)

Hillstar Business Intelligence for Microsoft Dynamics AX and NAV on Mobile, Desktop, Tablet


Let us prove to you how we can take the complexity out of the schema and truly enable users to answer the needed questions to run your business! Visit Hillstar Business Solutions at: www.HillstarBI.com

Friday, September 07, 2012

Friday Code Fun - X++ TextBuffer Usage





Well Happy Friday to everyone! Man what a fast week this has been. For me short weeks, because of long weekends are great when your in the long weekend. However the work does not go away... just means you have to cram more in a shorten time span.

With that I wanted to have a little code fun Friday post to lead you into the weekend with. I love chances of what I get to jump back into doing development. The Software Engineer in me I guess. At any rate, something I thought might be handy and useful that I would post and pass along is around the use of the TextBuffer class.

The following is the home for the TextBuffer class object for AX 2012.: TextBuffer Class [AX 2012]. It has some useful information, specifically an example of using it to read in a file. However my focus and use for this fun Friday code session is using it to detect numeric only string values.

With that, have a look at the following code segment.:

TextBuffer txtBuff = new TextBuffer();
;

txtBuff.setText("9919190");
txtBuff.regularExpressions(true); //Activate regular expressions

if (txtBuff.find("^[0-9]+$"))
{
// Has numeric only values
}
else
{
// Has Other characters, possibly including numeric values.
}


With the above usage of the TextBuffer class, and turning only Regular Expressions, we can now detect if a string value has numeric only characters, or has other Alpha, or non-numeric characters. This could be useful for several needs when working with Text files and string values in Dynamics AX. Further this logic works with previous versions of AX as well, not just AX 2012.

For those of you wanting to learn more about Regular Expressions, the Wikipedia home is a pretty good source.: Wikipedia: Regular expression

Well that's all for this week, check back soon as I will have a follow up post on the Organization Modeling example, back to Office 2013 + AX 2012, BI, Cloud and much more! Till Next Time!
Follow Me @:
RSS Feed  LinkedIn  Twitter

"Visit the Dynamics AX Community Page today!"

Labels: , , , , , , , , , ,

2 Comments:

Blogger Rachit Garg said...

Nice piece of information.

2:56 PM  
Blogger Rachit Garg said...

Nice piece of information.

2:57 PM  

Post a Comment

Links to this post:

Create a Link

<< Home


Copyright 2005-2011, J. Brandon George - All rights Reserved