Solved

Dynamics AX - Tab Delimited File

Posted on 2010-09-08
6
1,961 Views
Last Modified: 2012-05-10
Dear Experts,

I am requested to build a small job that will output some dataset values based on a CustAccount and a Date Range to a tab delimited text file.

I got as far as to create the form, add all my controls to the form:
DateFrom, DateTo, CustAccount and a Button.

On the Button'c clicked method I assume I should implement my code for this.
Please advise and also show me an example on how to retrieve lines from CustInvoiceTrans based on the form input and write these lines to a TAB delimited text file.

Your help appreciated. :)
0
Comment
Question by:Marius0188
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 33626980
Writer w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream (rootdir + "reports/yourFileName"), "encodingType"));
w.write(custLine);
w.flush();
finally { if (w != null) w.close(); }

custLine must be of type String custLine = data1 + "\t" + data2 + "\t" + data3 + "\t";
The better way to implement custLine is with StringBuilder.
0
 
LVL 16

Expert Comment

by:Valeri
ID: 33627133
>> custLine must be of type String custLine = data1 + "\t" + data2 + "\t" + data3 + "\t";
it should be
String custLine = new StringBuilder(data1).append("\t").append(data2).append("\t").append(data3).toString());
without the last "\t" as well.
0
 

Author Comment

by:Marius0188
ID: 33633872
Ok I will give this a try.
Not sure if I need a new question for this but let me try:

In the same project as above.
I want to run my code on the Button clicked method.
How do I reference the StringEdit controls on my form from within the clicked method?

Please show example.

Thanks.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 16

Expert Comment

by:Valeri
ID: 33634616
Is it web app or something else?
What is "StringEdit controls"? <textarea></textarea> ? or something else?
If it is <textarea name="MyTextArea"></textarea>, when you click on Button and submit the form, read the content of this textarea in this way :
String myTextAreaText = request.getParameter("MyTextArea");
If it's already tab delimited then it's your "custLine" from msg 33627133.
0
 

Author Comment

by:Marius0188
ID: 33635248
Nope not a webapp, in MS Dynamics AX I've added a form and added control to the form.
The control type is a StringEdit.


0
 
LVL 7

Expert Comment

by:quale-kaizen
ID: 33666716
Hi Marius0188, what version of AX are you using?

In AX 4.0 or later you can set the AutoDeclaration property of the control to true
and then you can get/set the control's value like this:

info(StringEdit.text());
StringEdit.text("ABC");

For exporting data to a CSV file you can use the AsciIo class.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now