Skip to main content

Posts

add run time control in axapta

This is a sample code to add run time control in axapta form. This is not 100% accurate code but this can help you to create run time control. There is no guarantee that  run time control will work perfectly in Ax I tried it but did not get much success on this but what success I get I shared here. public void init() { int i; int a; int d; int j=0; str lable; DictTable dictTable; TableId tableID; //TestId testId1; FormStringControl fStringTestID; str GetParm; str ParmCaller; ///// FormBParams formBParams; Array items; object formRunCaller; //FormRun formRun; //Args args; ; // if( element.args() ) // { // get string parameter // testId1= this.TestID() ; formRunCaller = element.args().caller(); if(formRunCaller) { testId1=formRunCaller.MethodA(); } // } //ssss /*if(element.args()) { testId1=element.args().parm(); } if(element.args().caller()) {//element.args().record().update

Runtime form controls using Axapta and save data

This is sample code for Runtime form controls using MSD Axapta and save data to table public void GenerateControl() { int i; int a; int d; str lable; DictTable dictTable; TableId tableID; ; i = 1; d=1; a=0; lable = ""; formTabControl = this.form().addControl(FormControlType::Tab,"MainTab"); formTabControl.heightMode(1); formTabControl.widthMode(1); formTabPageControl = formTabControl.addControl(FormControlType::TabPage,"MainTabPage"); formTabPageControl.caption("Test"); this.controlMethodOverload(true); formGroupControl = formTabPageControl.addControl(FormControlType::Group, "MyGroup"); formGroupControl.caption("Test"); while select * from _Question order by RecId { a = 1; while select * from answer where answer.GroupId == _Question.GroupId { if(_Question.ControlId == QuestionControlInputType::CheckBox) { formCheckBoxControl = formGroupCont

Fetch Method in Ax Reports of Microsoft Dynamics axapta x++

This is example of Fetch Method in Ax Reports of Microsoft Dynamics axapta x++ language. By this example you can get Idea that how to declare variables to use querybuilddatasource at run time. You can see how to add query range in querybuilddatasource  object. Here report programmable section used to execute. public boolean fetch() { QueryBuildRange rangeStatus; Query q = new Query(); QueryBuildDataSource qbds; ; q = this.query(); qbds = q.dataSourceTable(tablenum(Table1)); if (groupByClosed1 == 1) { qbds.addRange(fieldnum(Table1,Closed)).value(enum2Value(groupByClosed1)); } if (groupByImplemented1 == 1) { qbds.addRange(fieldnum(Table1,Implemented)).value(enum2Value(groupByImplemented1)); } if (groupByPending1 == 1) { groupByPending1 = 0; qbds.addRange(fieldnum(Table1,Closed)).value(enum2Value(groupByPending1)); } qbds.addSortField(fieldnum(Table1,TicketNo)); queryRun = new QueryRun(q); while(queryRun.next())

Get item from combobox using axapta code

Get item from combo box using axapta code. This function will return selected value of combo box control. I hope it can help you to avoid combo box troubleshooting. display str telNo() { telNo=CustTable::find(Table1.ParentOffice).Phone; Table1.TelNo = telNo; rec = ComboBox1.selectionChange(); officeName = ComboBox1.getText(ComboBox1.selectionChange()); parentOffice1 = Table1.ParentOffice; return CustTable::find(CustTable.AccountNum).Phone; }

Fill combo box using axapta x++ code

You can fill combo box two way first you can use lookup method using extended data type second if you are not using EDT then you can fill combo box by using following code. public void fillCombo() { CustTable custTable2; ComboBox1.clear(); SaleCalls.ParentOffice = "Abc"; custTable2 = CustTable::find(saleCalls.ParentOffice,false) rec = custTable2.RecId; while select * from Address where Address.AddrRecId == custTable2.RecId && Address.AddrTableId == custTable2.TableId { // ComboBox1.add(int2str(Address.RecId)); ComboBox1.add(Address.Name); } ComboBox1.selection(0); }

Method to Get Day difference using axapta

This method will show how to get day difference in ax. You need to declare variable as date type or you can use date extended data types same as you need to declare other type variable first to avoid error. Public void DayDiff() { //check for days Different tmpfromdt1 = date2str(tmpfromdt, 123, 2, 4, 2, 4, 4); tmpdiffdays = str2int(substr(tmpfromdt1,1,2)); mm = str2int(substr(DateFrom.valueStr(), 4, 2)); mm1 = str2int(substr(tmpfromdt1, 4, 2)); if(mm == mm1) { if(tmpdiffdays != 1) { tmpdiffdays1 = tmpdiffdays-1; } else { tmpdiffdays1 = 0; } } else { tmpdiffdays1 =0; } }

Procedure to Creating Budget Models in Axapta

To create a budget model: 1. From the Navigation pane, click GENERAL LEDGER→SETUP→BUDGET MODEL. 2. Click Ctrl+N to create a new record. 3. In the Budget Model field, type the name. 4. In the Name field, type a description of the budget model. 5. Select the Cash flow forecasts check box to apply cash flow forecasts to this model Attaching Sub models To attach a submodel to a budget model: 1. From the Navigation pane, click GENERAL LEDGER → SETUP → BUDGET MODEL. 2. On the Overview tab, click the budget model to which the submodel will be attached. 3. Click the Submodel tab. 4. Click Ctrl+N to create a new record, click the arrow, and then click the submodel to be attached to this model.