Skip to main content

Multiple Grid Selections 2

1. Yeni bir form yapın. (Ör : ATOL_CustTableSelection)
2. Formunuzun dataSource düğümüne formda göstermek istediğiniz tabloyu sürükleyip bırakın. (Ör CustTable)
3. Formunuzun metodlarını alttaki gibi düzenleyin.

1//classDeclaration metodunu değiştirin
2
3public class FormRun extends ObjectRun
4{
5Map markedLines;
6}


1//init metodunu değiştirin
2
3public void init()
4{
5super();
6
7this.initMarkedLines();
8}

1//yeni bir metod ekleyin
2void initMarkedLines()
3{
4;
5markedLines = new Map(Types::Int64, Types::String);
6}

01//yeni bir metod ekleyin
02void showSelected()
03
04{
05MapEnumerator mapEnumerator;
06RecID recId;
07int lineNum = 1;
08CustTable custTableLocal;
09;
10mapEnumerator = markedLines.getEnumerator();
11
12while (mapEnumerator.moveNext())
13{
14recId = mapEnumerator.currentKey();
15custTableLocal = CustTable::findRecId(recId, true);
16
17if(custTableLocal)
18{
19info(strFmt("%1 : %2 - %3",
20lineNum,
21custTableLocal.AccountNum,
22custTableLocal.Name));
23
24lineNum++;
25}
26}
27
28if(lineNum == 1)
29warning("@SYS34359");
30}

01//yeni bir metod ekleyin
02void markAll()
03{
04Query q = CustTable_ds.queryRun().query();
05QueryRun qr = new QueryRun(q);
06CustTable custTableLocal;
07;
08while(qr.next())
09{
10custTableLocal = qr.get(tableNum(CustTable));
11CustTable_ds.editMark(true, custTableLocal, true);
12}
13
14CustTable_ds.research(true);
15}

1//yeni bir metod ekleyin
2void clearSelections()
3{
4this.initMarkedLines();
5
6CustTable_ds.research(true);
7}

4. Formunuzun CustTable datasource’una alttaki gibi bir edit metodu ekleyin.

01edit boolean editMark( boolean _set,
02CustTable _custTable,
03boolean _mark)
04{;
05if (_set)
06{
07if (!_mark)
08{
09if (markedLines.exists(_custTable.RecId))
10{
11markedLines.remove(_custTable.RecId);
12}
13}
14else
15{
16markedLines.insert(
17_custTable.RecId,
18_custTable.AccountNum);
19}
20}
21return markedLines.exists(_custTable.RecId);
22}

5. Formunuzun Design düğümüne bir Grid ekleyin.
6. Formda göstermek istediğiniz tüm alanları ve edit metodunuzu formdaki giride sürükleyip bırakın.
7. Formunuza görüntüdeki gibi butonlar ekleyin. Ve formunuzun genel görünümünün görüntüdeki gibi olduğundan emin olun.

8. Butonların clicked metodlarından ilgili metodları çağırın. Örneğin ButtonMarkAll.clicked metodu alttaki gibi görünmeli :

1void clicked()
2{
3super();
4element.markAll();
5}

9. Formunuzu açıp test edin.

Dikkat : Bu yazıda daha önce değinmedimiz pek çok yapıyı zorunlu olarak kullandık.
Anlamadığınız konuları özellikle sorarsanız ayırca makale yazarak açıklayabilirim.
Bu kodları tam olarak anlamadan canlı ortamda kullanmayın.
Emre TÜFEKÇİ

Popular posts from this blog

Dynamics Axapta: Sales Orders & Business Connector

Well, again folllowing my same idea of writting close to nothing and pasting code, I'll paste in some code to create a sales order from some basic data and the invoice it. I'll try to explain more in the future. AxaptaObject axSalesTable = ax.CreateAxaptaObject("AxSalesTable"); AxaptaRecord rcInventDim = ax.CreateAxaptaRecord("InventDim"); AxaptaRecord rcCustTable = ax.CreateAxaptaRecord("CustTable"); rcCustTable.ExecuteStmt("select * from %1 where %1.AccountNum == '" + MySalesOrderObject.CustAccount + "'"); if (MySalesOrderObject.CurrencyCode.Trim().Length == 0) MySalesOrderObject.CurrencyCode = rcCustTable.get_Field("Currency").ToString().Trim(); string sTaxGroup = rcCustTable.get_Field("taxgroup").ToString().Trim(); //set header level fields axSalesTable.Call("parmSalesName", MySalesOrderObject.SalesName.Trim()); axSalesTable.Call("parmCustAccount", M

Passing values between form and class

Class name is EmplDuplication and Form is EmplTable . void clicked() {    MenuFunction mf;    args args = new Args();    ;     args.record(EmplTable);     mf = new menufunction(identifierstr(EmplDuplication), MenuItemType::Action); mf.run(args); } Meanwhile, in the main() method of the EmplDuplication class, we need to put this Axapta x++ code to get the datasource: static void main(Args args) {     EmplDuplication EmplDuplication; EmplTable localEmplTable; ;     if(args.record().TableId == tablenum(EmplTable)) localEmplTable = args.record();     ... }