Skip to main content

Hello, I’d like to update the values on a processing screens grid. Specifically the data on the ‘Create Transfer Orders’ processing screen, shown below.

The graph is SOCreate and I can see that the data is created using a view called FixedDemand.

hPXFilterable]
public PXFilteredProcessingJoin<SOFixedDemand, SOCreateFilter,
InnerJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<SOFixedDemand.inventoryID>>,
LeftJoin<SOOrder, On<SOOrder.noteID, Equal<SOFixedDemand.refNoteID>>,
LeftJoin<SOLineSplit, On<SOLineSplit.planID, Equal<SOFixedDemand.planID>>,
LeftJoin<INItemClass,
On<InventoryItem.FK.ItemClass>>>>>,
Where2<Where<SOFixedDemand.inventoryID, Equal<Current<SOCreateFilter.inventoryID>>, Or<Current<SOCreateFilter.inventoryID>, IsNull>>,
And2<Where<SOFixedDemand.demandSiteID, Equal<Current<SOCreateFilter.siteID>>, Or<Current<SOCreateFilter.siteID>, IsNull>>,
And2<Where<SOFixedDemand.sourceSiteID, Equal<Current<SOCreateFilter.sourceSiteID>>, Or<Current<SOCreateFilter.sourceSiteID>, IsNull>>,
And2<Where<SOOrder.customerID, Equal<Current<SOCreateFilter.customerID>>, Or<Current<SOCreateFilter.customerID>, IsNull>>,
And2<Where<SOOrder.orderType, Equal<Current<SOCreateFilter.orderType>>, Or<Current<SOCreateFilter.orderType>, IsNull>>,
And2<Where<SOOrder.orderNbr, Equal<Current<SOCreateFilter.orderNbr>>, Or<Current<SOCreateFilter.orderNbr>, IsNull>>,
And<Where<INItemClass.itemClassCD, Like<Current<SOCreateFilter.itemClassCDWildcard>>, Or<Current<SOCreateFilter.itemClassCDWildcard>, IsNull>>>>>>>>>,
OrderBy<Asc<SOFixedDemand.inventoryID>>> FixedDemand;

I’m not sure of the best way to do this. Rather than change the BQL I was wondering whether it is possible to take the BQL result, then loop through the results, making the changes I require.

I was thinking I could extend the SOCreate graph and create a duplicate view called FixedDemand1, then in a view delegate for the original FixedDemand, I could update the results in FixedDemand1 return them.

public virtual IEnumerable FixedDemand()
{
foreach (SOFixedDemand item in FixedDemand1.Select())
{
item.fieldA = "SomeValue";
item.fieldB = -99;
result.Add(item);
}
return result;
}

This mostly works, I can update the data I need BUT I cannot get the Selected value to persist. So when the Process button is pressed, the selected rows are unselected and so no rows are processed. Any suggests, or alternative ideas welcome.

It looks like you'd be declaring a new data view delegate on your graph extension (FixedDemand()) to override the original one. Does that mean you've redeclared the original data view (FixedDemand;) as well?

Also, you're pulling the rows from the new data view (FixedDemand1), meaning they wouldn't be 'selected', correct?


Hi @stephenward03 
 

Yes, you can just use bql of base graph and than modify result as you wish.

    public class SOCreateExt : PXGraphExtension<SOCreate>
{
public virtual IEnumerable fixedDemand()
{
foreach (PXResult<SOFixedDemand, InventoryItem, SOOrder, SOLineSplit, INItemClass> item in Base.FixedDemand.View.BqlSelect.CreateView(Base).SelectMulti())
{
yield return item;
}

}
}

  We cannot use Base.FixedDemand.Select() because it will invoke our fixedDemand() view delegate.

So i would suggest to create a new view based on a default view bql and than call it.


@darylbowman 

You correct, in the extension, I copied the BQL from FixedDemand to define FixedDemand1.

The graph grid is bound to FixedDemand but I’ll building the data from FixedDemand1, so I don’t see how selecting a row on the processing screen has any affect on the FixedDemand1 view. 

But I also don’t know how to work around this. 


@taras 

Your code does allow me to modify the results, this works. I understand that  Base.FixedDemand.Select() cannot work puts us into an endless loop, I’ve never seen .BqlSelect.CreateView(Base).SelectMulti() and that is very useful. 

The problem with this method is that when I press the Process button, the row selections are still cleared and no records are processed :(


...the row selections are still cleared and no records are processed

I’m actually dealing with this as well on a custom screen I built. I’ve built it like all the rest but haven’t spent time to figure out what’s wrong. What version is this?


I’m working with version - 23.208.0026


Reply