Current filter:
                                You should refresh the page.

                                You are using an older version of the DevExpress Support Center.

                                  • I have this code, but I need to make several "[DataSourceProperty ..." because not only "DoctosCli" also need to do it from "DoctosInve" or "DoctosPro".As I do?
                                    those filters


                                    those filters
                                    in a single field called "SaldoItems"

                                    private SaldoItems fSaldoItems; [DataSourceProperty("DoctosCli.Bodega.SaldoItems")] [DataSourceCriteria("StockGral > 0")] [Association("SaldoItems-Transa", typeof(SaldoItems)), ImmediatePostData] public SaldoItems SaldoItems { get { return fSaldoItems; } set { SetPropertyValue("SaldoItems", ref fSaldoItems, value); if (!IsLoading && !IsSaving && value != null) { if (DoctosCli != null || DoctosInv != null) { Item = SaldoItems.Item; Stock = value.StockGral; } } } }

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Andres Ricardo,

                                There are two ways to implement this filter:

                                1. Use the DataSourceCriteria attribute instead of DataSourceProperty:
                                [DataSourceCriteria("StockGral > 0 && (Bodega = '@This.DoctosCli.Bodega' || Bodega = '@This.DoctosPro.Bodega' || Bodega = '@This.DoctosInve.Bodega')")]

                                Here, I supposed that the SaldoItems class has the Bodega property implementing a one-to-many relationship between SaldoItems and Bodega. The filter uses the '@This' parameter returning properties of the current object - see Current Object Parameter.

                                2. Implement a non-persistent invisible collection returning the required data source, and specify this collection in the DataSourceProperty attribute. See an example of this solution in the Scenario 4 - Populate the Lookup Manually part of the How to: Filter Lookup List Views topic.

                                Let me know if you need further assistance.

                                Show all comments
                                • Andres Ricardo Vanegas Castiblanco 03.07.2016

                                  >>>Here, I supposed that the SaldoItems class has the Bodega property implementing a one-to-many relationship between SaldoItems and Bodega.

                                  my relationship is this:


                                  private Bodega bodega; [VisibleInLookupListView(false)] [Association("Bodega-SaldoItems", typeof(Bodega)), ImmediatePostData] public Bodega Bodega { get { return bodega; } set { SetPropertyValue("Bodega", ref bodega, value); } }

                                  In Bodega.cs

                                  //**** [Association("Bodega-SaldoItems", typeof(SaldoItems))] public XPCollection SaldoItems { get { return GetCollection("SaldoItems"); } }

                                  when implemented the first solution that gives me, I generates nothing in the filter.

                                  send screenshot

                                • Anatol (DevExpress Support) 03.07.2016

                                  From the information you provided, it is unclear why this filter does not work in your project. Please provide a sample project demonstrating the issue.

                                • Andres Ricardo Vanegas Castiblanco 03.07.2016

                                  in the following link, there is a ticket where up a sample project with a database, classes are:
                                  SaldoItem.csBodega.csTransa.cs      in transa this a 'SaldoItems "field

                                  attached a video where the process is shown.

                                  the source code is not updated with your suggestions, please the "SaldoItem" field of "Transa.cs" class add to, then do the video process and validate your suggestion.

                                  in "Entrada de Inventario" the perfect process becomes, in "Salida de Inventario" is where I use the "SaldoItems" field is where I use the filter "[DataSourceCriteria ("StockGral > 0 && (Bodega = '@This.DoctosCli.Bodega' || Bodega = '@This.DoctosPro.Bodega' || Bodega = '@This.DoctosInve.Bodega')")]"

                                • Anatol (DevExpress Support) 03.08.2016

                                  You did not post a link. Do you mean the project from the The analysis module is not working properly ticket? I have reviewed its business classes and found that the Transa class has the DoctosInv property rather than DoctosInve mentioned in your initial question. This is likely the cause why the lookup editor is empty.

                                  If this does not help, I would highly appreciate if you post a smaller example containing only classes related to the issue. In addition, it appears that the most part of the video you attached is not related to the issue. It would be very helpful if you provide a video demonstrating only the necessary steps. Thanks in advance for your cooperation.

                                • Andres Ricardo Vanegas Castiblanco 03.08.2016

                                  Had a syntax error, but still I have changed and I do not generate anything, and the video you send if it has to do with my problem, except that the user interface change the names of objects, but internally called "DoctosInv , Transa ".. etc.
                                  Further to this, the "DoctosCli" object if well written and when I will make a "DoctosCli" I spend the same mistake, I do not generate anything.
                                  Do you tried the code to send you and implement your solution to validate what I'm saying, I did a test as I showed in the video?

                                • Andres Ricardo Vanegas Castiblanco 03.09.2016


                                • Anatol (DevExpress Support) 03.09.2016

                                  I have tested your project. When I used the following attribute:

                                  [DataSourceCriteria("StockGral > 0 && (Bodega = '@This.DoctosCli.Bodega' || Bodega = '@This.DoctosInv.Bodega' || Bodega = '@This.DoctosPro.Bodega')")]

                                  the SaldoItems lookup contained 1 record, although there were more records with StockGral > 0. However, when I removed the "StockGral > 0" condition, the lookup contained all the necessary records. So, I conclude that the StockGral property value is calculated incorrectly on the server side. Please ensure that the expression specified in this property's PersistentAlias attribute is correct. In addition, note that the DataSourceProperty attribute should be removed from the SaldoItems property.

                                • Andres Ricardo Vanegas Castiblanco 03.09.2016

                                  I have done the test.
                                  Do you tell me that would have problems in my field calculated?
                                  this is my calculated field, do I have something wrong?
                                  this field is in the class; "SaldoItems.cs"

                                  [PersistentAlias ( "(EntraEne + EntraFeb + EntraMar + EntraAbr + EntraMay + EntraJun + EntraJul + EntraAgo + EntraSep + EntraOct + EntraNov + EntraDic + EntraAA) - (SaleEne + SaleFeb + SaleMar + SaleAbr + SaleMay + SaleJun + SaleJul + SaleAgo + SaleSep + + SaleOct SaleNov + + SaleDic SaleAA + SaleCie) ")] // [Navegable (falso)] [ModelDefault ( "formatSalida", "{0:. #, # ##}")] [ModelDefault ( "editMask", "########, ########. ##")] pública StockGral decimal { obtener { volver Convert.ToDecimal (EvaluateAlias ( "StockGral")); } }
                                • Andres Ricardo Vanegas Castiblanco 03.09.2016

                                  I need that additional filter StockGral > 0 

                                • Anatol (DevExpress Support) 03.09.2016

                                  Yes, there is an issue - the StockGral property has a different value when calculated on the client and on the server side. I have researched the issue and found that it occurs because some fields from the PersistentAlias expression have a null value in the database, and null + a number always gives null. Probably, these properties have null values because they were added after initial rows were created in the SaldoItems table. To resolve the issue, either correct the database values, or use the IsNull function to replace null values with zeros in the StockGral property's expression:

                                  [PersistentAlias("(IsNull(EntraEne, 0) + IsNull(EntraFeb, 0) + IsNull(EntraMar, 0) + IsNull(EntraAbr, 0) + IsNull(EntraMay, 0) + IsNull(EntraJun, 0) + IsNull(EntraJul, 0) + IsNull(EntraAgo, 0) + IsNull(EntraSep, 0) + IsNull(EntraOct, 0) + IsNull(EntraNov, 0) + IsNull(EntraDic, 0) + IsNull(EntraAA, 0))-(IsNull(SaleEne, 0) + IsNull(SaleFeb, 0) + IsNull(SaleMar, 0) + IsNull(SaleAbr, 0) + IsNull(SaleMay, 0) + IsNull(SaleJun, 0) + IsNull(SaleJul, 0) + IsNull(SaleAgo, 0) + IsNull(SaleSep, 0) + IsNull(SaleOct, 0) + IsNull(SaleNov, 0) + IsNull(SaleDic, 0) + IsNull(SaleAA, 0) + IsNull(SaleCie, 0))")]
                                • Andres Ricardo Vanegas Castiblanco 03.10.2016

                                  Thank you , I have helped promptly.

                                • Anatol (DevExpress Support) 03.11.2016

                                  You are welcome!