Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamics AX - Tab Delimited File

Posted on 2010-09-08
6
Medium Priority
?
2,168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
Valeri earned 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

705 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