Solved

Dynamics AX - Tab Delimited File

Posted on 2010-09-08
6
2,002 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 45
Get id from json Data with NewtonSoft 3 34
Runtime Error 2 28
Counting connections to SQL Server through C# 3 29
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

867 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

19 Experts available now in Live!

Get 1:1 Help Now