Rabu, 11 Mei 2011

TextBuffer at Dynamics Ax and my Foolishness


spAXrrttaaaaannnn!! ...

So ... this is my foolishness at my work ...
My friend erick want me to help him to produces some report which display a comment from user's input. so I used Memo for the String length in order to handle a possibility of length from the comment ... coz the comment may be like a story, have many paragraph. But unfortunately after the report is running there's some paragraph not displayed at the report and its because the height of the object who generated from EDT which is have lenght memo. in other word the object's height(which is generated from String) is not dynamic
So i use TextBuffer Class to handle this problem.
Here we are ... the TextBuffer ...

public class ReportRun extends ObjectRun
{
transdate Fromdate, Todate;
dialogfield dialogfromdate,dialogtodate,dialogComment;
transdate tempDate;
CustAccount tempCustAccount;
qty tempQty;
qty tempQtyconv;
str tempitemid;
IBMKeterangan Keterangan;
int i;
int panjangstr;

//TextBuffer Class
TextBuffer tb;
}

at Fetch
public boolean fetch()
{
boolean ret;
tb = new TextBuffer();



element.query().dataSourceNo(1).addRange(fieldnum(salesline,ShippingDateConfirmed)).value(strfmt('%1..%2',fromdate,todate));

tb.setText(Keterangan);

panjangstr = tb.numLines();
DistempKeterangan.height(panjangstr,units::char);

ret = super();

return ret;
}

Wait ..so where the Foolishness???
Here is the Foolishness ... to Handle the Dynamic Height's object you don't have to use TextBuffer class because Microsoft Dynamics Ax have a feature for this issue.
You can find the solving problem in a properties from the object which is generated from the variable that u have.

just right click from the object -> properties -> and voila ..there's a DynamicsHeight.
Change the DynamicsHeight to Yes.

Waakakkak .. Damd it!.

Tidak ada komentar:

Posting Komentar