Hi all,
How to add real type fields. What syntax?Field ABS_sumAmountMST
Hi all,
How to add real type fields. What syntax?Field ABS_sumAmountMST
Finally, could you please use only relevant tags in your questions. Now you used tags like "Connector for CRM", "Windows 8 and Mobile Apps", "Forecaster and FRx", "Reporting and BI" and others, even if they are not related. In general this doesn't serve your purpose. But instead I encourage you to put effort in describing your problem already in your initial question. That way it's more likely that others can help you.
I think I already instructed you on that just a couple of messages above.
If you are now in markChanged method, you can use this code:
ABS_SumAmountMST.realValue(this.calculateSumAmountTransactCurrency());
In general you can pass values by using "=" operator. For example if you want to pass number 5 to variable myNumber, you call myNumber = 5; It works just like in most other programming languages.
If you want to pass the return value of this.calculateSumAmountTransactCurrency() into the ABS_SumAmountMST.realValue() method, you use the solution that I provided above.
How to pass returned sumValue for other method markChange and reset value. public void markChanged()
{
super();
this.calculateSumAmountTransactCurrency();
ABS_SumAmountMST.realValue();
}
You should not call markChanged method, it's called automatically when the user selects record(s) in the form.
But you should call your calculateSumAmountMST from markChanged method (if you wish to run your method every time the mark is changed).
"How to call other method" works always the same way. "objectName.methodName()".
Since markChanged and calculateSumAmountMST are in the same object (the form data source), you can call it with "this.calculateSumAmountMST()".
How to call other method in my published method. It called markChange which is overridden. Both methods are in data source custtrans datasource methods. One method is mark changed other is calculateSumAmountMST. How to call markchanged method in method calculateSumAmountMST
Your method doesn't need to return anything.
Or, if you want to, you can call MyField.realValue(element.calculateSumAmountTransactCurrency()); This code should not be inside your method (that would be an infinite loop), it should be where you trigger the sum calculation.
You know now how to calculate the sum, and how to set value to an unbounded field. How exactly you organize your code is up to you.
MyField.realValue(mySumValue) before return?
I already told you that in my first reply:
If your field is called MyField (and AutoDeclaration is Yes), you can set value to it like this:
MyField.realValue(mySumValue);
What do you mean by "field menu item"?
By the way, your code misses the amount of the first custTrans. In your while statement you should call getNext only after handling the sum of the current custTrans (that you had when you first entered the while statement.
How to set output setValue data to ABS_SumAmountMST field menu item. Given my code:
public real calculateSumAmountTransactCurrency()
{
CustTrans custrans;
real sumValue;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
ABS_SumAmountMST.realValue(0);
//super();
//sumAmountMST.realValue(0);
helper.parmDatasource(CustTrans_DS);
custrans = helper.getFirst();
while (custrans.RecId != 0)
{
//info(custrans.AmountMST.toString());
info(custrans.RetailStoreId);
custrans = helper.getNext();
// ABS_SumAmountMST=sum(ABS_SumAmountMST, custrans.AmountMST);
sumValue+=custrans.AmountMST;
}
// return ABS_SumAmountMST;
return sumValue;
}
Just use the same data type than the field that you are summing!
If you add multiple AmountMST values, it's still AmountMST. There's no special data type for "summed value", it's a number just like the amounts that you summed together.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156