Solved

Dynamics AX - Tab Delimited File

Posted on 2010-09-08
6
2,120 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 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

636 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