Hakan Çelik
Hakan Çelik

Reputation: 17

In x++, How can I sum the numerical values of the different customers I have chosen?

How can I sum the numerical values of the different customers I have chosen?

For example:

e006-M000021 total amount = 1,605.00+1605.00+1605.00+(-96.00)+...
e006-M000022 total amount = 5,964.85+(-1,075.00)+5.541.60+...

enter image description here

I will use the result as follows;

These records are also in my caller form. After selecting these records, I want the textbox in the new form I opened with the button to be

e006-M000021 total amount = XXX,
e006-M000022 total amount = XXX.

Now I can transfer the selected record and the values of the record to the textbox in the called form. But I am not able to sum the amounts corresponding to multiple and customer IDs.

My called form init method code:

    public void init()
    {    
       super();    
       if( element.args() && element.args().dataset() == tableNum(ARCSendSmsCustomerTmp))    
       {    
           Callertmp = element.args().record();    
       }    
       ////username and password are pulled from dealer parameters.    
       ARCDealerSmsParameters = ARCDealerSmsParameters::find();    
       ctrlUsername.text(ARCDealerSmsParameters.DealerUsername);    
       ctrlPassword.text(ARCDealerSmsParameters.DealerPassword);    
       ctrlSmsText.text(strFmt( @'SAYIN %1, %2 tarihi itibari ile toplam %3 TL gecikmiş ödemeniz bulunmaktadır.',Callertmp.CustName,Callertmp.DueDate,Callertmp.CurrencyAmount));    
       ctrlPhoneNumber.text(Callertmp.CustPhone);    
   }

Upvotes: 0

Views: 668

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18061

You can do this using the multiselection design pattern.

public void init()
{    
   ARCSendSmsCustomerTmp tmp;
   ARCSendSmsCustomerTmp callertmp = element.args().record();    
   FormDataSource fds = callertmp.datasource();
   Amount amount;
   super();    
   for (tmp = fds.getFirst(1) ? fds.getFirst(1) : fds.cursor(); fds; fds = fds.getNext())
   {
        amount += tmp.CurrencyAmount;
   }    
   ////username and password are pulled from dealer parameters.    
   ARCDealerSmsParameters = ARCDealerSmsParameters::find();    
   ctrlUsername.text(ARCDealerSmsParameters.DealerUsername);    
   ctrlPassword.text(ARCDealerSmsParameters.DealerPassword);    
   ctrlSmsText.text(strFmt("SAYIN %1, %2 tarihi itibari ile toplam %3 TL gecikmiş ödemeniz bulunmaktadır.", Callertmp.CustName, Callertmp.DueDate, amount));    
   ctrlPhoneNumber.text(Callertmp.CustPhone);    
}

Upvotes: 0

Related Questions