Skip to main content

Hi,

iam pulling SOLines items in a new grid using Soline view, but i Dont need all the SOLines and i need to apply a  filter, How can i modify my view to acheive that? any help is greatly Appriciated 

Thanks in Advance

One option is to duplicate the view in your graph extension. Just copy the Transactions view definition from SOOrderEntry.cs and give the view a different name. Add in the extra criteria and then your new grid can pull it’s values from your new view.


Hi @Django ,

                     Thank you for the Response, iam aware of it, But in my case i have added a Dac Extension Bool Feild to the SOline, and when i select it only those records of SOLine need to pass to new grid. This is the existing view which i have. is there any possiblilty that i can add the Extension Dac Feild to the Conditon of this View?

        public PXSelect<
            SOLine, 
            Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>,
                And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>>>> 
            SolineView; 


Yes, absolutely. You just need to include the DAC extension name instead of the original table name. For instance, possibly:

public SelectFrom<SOLine>.
Where<SOLine.orderType.IsEqual<SOOrder.orderType.FromCurrent>.
And<SOLine.orderNbr.IsEqual<SOOrder.orderNbr.FromCurrent>>.
And<SOLineExt.usrOtherField.IsEqual<something>>>.View SolineView;

 


Hi @darylbowman ,

                                Thank you for responding, I have Tried like this but the View Does not get Records

 


Could you post your code for the data view and also the custom DAC field?

I assume you’ve checked the database to verify the field you are querying actually has the value you expect?


        public PXSelect<
            SOLine,
            Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>,
                And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>, And<SOLineExt.usrSelect, Equal<True>>>>>
            SolineView;

 

    #region UsrSelect
    ÂPXBool]
    ePXUIField(DisplayName="Select")]

    public virtual bool? UsrSelect { get; set; }
    public abstract class usrSelect : PX.Data.BQL.BqlBool.Field<usrSelect> { }


        public PXSelect<
            SOLine,
            Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>,
                And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>, And<SOLineExt.usrSelect, Equal<True>>>>>
            SolineView;

 

    #region UsrSelect
     PXBool]
    ePXUIField(DisplayName="Select")]

    public virtual bool? UsrSelect { get; set; }
    public abstract class usrSelect : PX.Data.BQL.BqlBool.Field<usrSelect> { }

Hi, I hope you’re doing well,

Maybe you can try to implement a view delegate, instead of a select statement.

If I understood the requirement correctly, You’re creating a new grid for selected SOLines, right?

If yes, then you can try and implement another view + delegate;
 

public SelectFrom<SOLine>.View SelectedTransactions;

public virtual IEnumerable selectedTransactions()
{
foreach(SOLine line in Base.Transactions.Select().RowCast<SOLine>().ToList().Where(x => x.GetExtension<Ext>()?.UsrSelect == true))
{
yield return line;
}
}

Something like this.

 

Or if it’s not the one that you want, Can you try doing this on your current view
 

public PXSelect<
            SOLine,
            Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>,
                And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>, And<Current<SOLineExt.usrSelect>, Equal<True>>>>>
            SolineView;

Add Current on your SOLineExt.usrSelect

 

Hope this helps.


I’m noticing that the custom field you have is not a persisted field. This means that either through the UI or through code, you’d have to be setting UsrSelect to true. If this IS actually happening, chances are the view was cached before this happened, meaning that you’d probably need to be executing the select again in order for it to display the selected records.

To be clear, this is all speculation. Perhaps someone with more concrete knowledge like @Zoltan Febert or @Keith Richardson could confirm this.


Hi @Atiq were you able to find a solution? Thank you!


No @Chris Hackett ,

I have not Found the Solution for it Yet


Try using the view’s Cache.Updated to get the selected records

When the user selects the checkbox on the line it will add the record to the Updated list on the view’s cache.  You can just iterate that list for your process.

eg if you want to grab the selected lines from the SalesOrder Details into a list for processing...

List<SOLine> materials = Base.Transactions.Cache.Updated.RowCast<SOLine>().ToList();


Reply