I am trying to identify which line items on a sales order have been fulfilled and which not. I cannot find a field for this on the item record. I need to perform an operation after certain item types have been fulfilled.
Thank you,
James
you can loop the items
for (var i = 0; i < SaleOrder.getLineCount({sublistId: 'item'}); i++) {
var quantityFullfiled= SaleOrder.getSublistValue( { sublistId: 'item', line: i, fieldId: 'quantityfulfilled' }
}
Related
I have a collection of transactions with relations and I would like to sum column separated by condition of relation column. Right now I have this:
$delegatedProvision = 0;
$ownProvision = 0;
foreach ($transactions as $transaction) {
if ($transaction->discount->consider_improvement) {
$delegatedProvision += $transaction->stats->$column;
continue;
}
$ownProvision += $transaction->stats->$column;
}
$this->salesCollection->put('delegatedProvision', $delegatedProvision);
$this->salesCollection->put('ownProvision', $ownProvision);
It works but I would like to use Laravel collections. So far I have just this:
$provision = $transactions->sum(function ($transaction) use ($column) {
return $transaction->stats->$column;
});
And I don't know how to use condition in sum() method and according column $transaction->discount->consider_improvement (which is boolean) have sum in separated variables. I can use filter each for different consider_improvement but it means that I have to iterate all transactions twice.
Try this:
$collection->where(/* your condition */)->sum($column);
I have a table with filtered results.
I need to update all rows "PayƩ" of the table in a client script.
I know how to update the first active row of the field "PayƩ". But I need to update all the row of that field in one time (in a call back function)
Can you help me.
Here is the screen shot of what I need
Thanks
This should do the trick:
var rows = app.datasources.TABLE_NAME.items;
for(var i = 0; i < rows.length; i++){
rows[i].Paye = true;
}
So say i have a collection:
const collection = [0,3,2,4];
var r = collection.filter((item) => {
return item > 2;
}).map((item) => {
return item + 2;
});
// I could just `.map()` them back in but that seems ineffective
console.log(r); // 5,6
Is there a functional (fp) way to compose this code to update my previous collection to get the expected result (given the index of the result is important) ?
e.g. expected result: [0,5,2,6]
How about
var r = collection.map(item => item > 2 ? item + 2 : item)
instead?
I.e. .map all items but only modify the ones that match your condition.
I have been using this code to find whether a school exists in a collection or not
var sn = 'mit';
var schoolexists = Schools.find({schoolname: sn}, {limit: 1}).count() > 0;
if(schoolexists == true){
alert('school already exists');
}
This works but i now need to introduce two more pointed conditions like schoollocation,studentid and get only the records that satisfy those three conditions. How would i introduce the two extra conditions?.
Just add them to the selector (the first argument):
var selector = {
schoolName: 'mit',
shoolLocation: 'cambridge',
studentId: 'abc123'
}
var schoolexists = Schools.find(selector, {limit: 1}).count() > 0;
Selector fields are ANDed together.
I am trying to re define the select query and make it user defined by first listing out all the fields in one checkbox list and grouping them in another and providing a where condition for selected check boxed fields. I am returning a view model that contains the list of all my columns.
I need to know how to populate the list from my view model onto a asp.net checkbox list.
Thanks in advance,
Hrg
As per my understanding try this
#for (int i = 0; i < Model.PropertyName.Count(); i++)
{
<p>
#Html.CheckBox("model.PropertyName[" + i + "]", !Model.PropertyName[i])
</p>
}
You van use this also
#for (int i = 0; i < Model.PropertyName.Count(); i++)
{
#Html.CheckBoxFor(model => Model.Tags[i])
}