Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Override equals behavior for SimpleType

    First i want to thank everyone has been woked in this great project SmartGWT, I am using LG

    I am creating a simple type for MoneyAmount (it contains the amount and the currency) and i define its validation, formatting and editing behavior, but i still couldn't override the equals behavior that used with Grid filter.

    I find that there is method fieldMatchesFilter in the Datasource , but i don;t know how to override its implementation in GWT
    So i ask if this is possible, and if yes could you please give my hint tip to start from it.

    Thanks a lot
    Last edited by daliakamal; 17 Dec 2010, 01:49.

    #2
    Hi,

    do we indeed need to do something like this (create 'compareTo()' & 'equals()' methods somehow) when using SimpleTypes in the client?

    I'm not sure what we can and can't do with SimpleTypes as simple tests don't really work:
    - client-side grid filtering?
    - get those fields in the Formula Builder?
    - using standard grid Summary functions?

    thx

    Comment


      #3
      The primary use case of SimpleType is to apply special formatting and validation rules while continuing to use a normal atomic value type (String, Date, etc). Currently, client-side grid filtering and grid summary functions won't work with a SimpleType that stores a custom Java Object as it's value. There's no known issue with FilterBuilder however.

      If at all possible, use an atomic type to represent a SimpleType's value, not a custom Java Object.

      Comment


        #4
        That is the problem and the reason to use a SimpleType I thought - this datatype can't be represented by an atomic type.

        As the OP's sample:
        MoneyAmount is the SimpleType holding 2 fields:
        -int currencyID
        -double amount

        Technically, we could implement a SUM function which converts all MoneyAmounts into the same currencyID for a certain date (if they are not all the same currency), and take the sum of that to use as a grid summary function.

        * But having no possibility to use the grid filter with SimpleTypes is a bigger issue. Is this not possible at all, or could this be a new feature?
        Sorry to ask as I haven't checked this yet - but does SmartGWT allow to send a resultset after fetch back to the webserver component and implement the filter there?
        The backend does not support filtering, so in the worst case, we would have to do a re-fetch after the initial fetch, then apply and implement the filters manually which is a ton of work - this is the reason to do it client-side.


        * I also was talking about the Formula Builder (this one http://www.smartclient.com/smartgwt/showcase/#grid_appearance_formula_sumamry_builder). A small investigation is not showing my SimpleTypes (they inherit from fieldType.Any) fields in the pop-up of the Formula Editor - that's why I asked if this is also related to the SimpleType usage.

        Comment


          #5
          Again, the primary use case for SimpleTypes is adding formatting and validation rules to a standard atomic type.

          Your usage here combines something that could be represented by two fields into a single SimpleType. We don't know what your ultimate storage medium is and how this value is stored, but from the point of view of relational data normalization, it's actually worse to put this compound value into a single column (inability to do queries separately on the currency type and currency value).

          If you have some kind of "backend" that doesn't support filtering, then yes, you'll probably need to implement filtering in your web tier unless the data volume involved is low enough that you can deliver the entire dataset to the browser.

          On the Formula Builder (sorry we misread that as FilterBuilder before): it will only show fields of numeric type. Since your custom SimpleType doesn't extend from a numeric type it's being ignored. But as with filtering and other functions, the underlying value of your SimpleType is going to need to be numeric for this to work.

          Finally, yes, support for filtering and other operations could be added for SimpleTypes that store a custom object - this would be a Feature Sponsorship.

          Comment


            #6
            We're using a much simpler SimpleType for currency fields that inherits from Float and uses custom display and edit formatters and parsers. These fields are not working with the Filter Builder. They show up in the list of fields and you can select criteria for them but the resulting criteria does not include them.

            Do I understand that SimpleType fields can't be used in filters? Even those that are only for formatting purposes and otherwise inherit from a standard numeric type. Is there some workaround for this?

            Comment


              #7
              Hi Jay, a SimpleType like you describe should be fine. The discussion above is about a SimpleType where levi was trying use some kind of object like

              Code:
              { booleanValue:false, someOtherProperty:"someValue" }
              .. and be able to use this object equivalently to a primitive boolean pervasively - editing, searching, sorting, hiliting etc. That won't work as things stand, but is also not an approach we'd recommend (more effort, less results).

              There shouldn't be a problem with a SimpleType like you describe and a FilterBuilder. Can you provide some details about what you're seeing - is it possible the SimpleType has no valid operators, for example?

              Comment


                #8
                The FilterBuilder appears to be simply dropping those fields from the criteria. If I enter a criterion in the FilterBuilder UI involving one of these fields (all of the operators are available) the result of calling FilterBuilder.getCriteria() looks like this (0 criteria in the array).

                {_constructor: "AdvancedCriteria", operator: "and", criteria: Array[0]}

                If I create two criteria, one with a standard text field and the second with one of our "currency" fields there is only one criteria in the array, the "currency" related one is just not there.

                {_constructor: "AdvancedCriteria", operator: "and", criteria: Array[1]}

                The field definition is simply

                <field name="IRET" title="Book Retail" type="currency"/>

                Here is the client side code that sets up the SimpleType.
                Code:
                		currencyType = new SimpleType("currency", FieldType.FLOAT);
                		currencyType.setNormalDisplayFormatter(new SimpleTypeFormatter() {
                			@Override
                			public String format(Object value, DataClass field,
                					DataBoundComponent component, Record record) {
                				if (value==null) value = "0";
                				Double valueDouble = Double.valueOf(value.toString());
                				return homeCurrencyFormat(valueDouble);
                			}
                		});
                		currencyType.setShortDisplayFormatter(new SimpleTypeFormatter() {
                
                			@Override
                			public String format(Object value, DataClass field,
                					DataBoundComponent component, Record record) {
                				if (value==null) value = "0";
                				Double valueDouble = Double.valueOf(value.toString());
                				return homeCurrencyFormat(valueDouble);
                			}
                		});
                		currencyType.setEditFormatter(new SimpleTypeFormatter() {
                
                			@Override
                			public String format(Object value, DataClass field,
                					DataBoundComponent component, Record record) {
                				if (value==null) value = "0";
                				Double valueDouble = Double.valueOf(value.toString());
                				return homeCurrencyFormat(valueDouble);
                			}
                		});
                		currencyType.setEditParser(new SimpleTypeParser() {
                
                			@Override
                			public Object parseInput(String value, DataClass field,
                					DataBoundComponent component, Record record) {
                				if (value==null) value = "0";
                				try {
                					// Remove anything but digits and the decimal point
                					String strippedValue = value.toString().replaceAll("[^0-9\\.]", "");
                					Double valueDouble = Double.valueOf(strippedValue.length()==0 ? "0" : strippedValue);
                					if ("0".equals(IPGui.homeCurrencyDecimals))
                						return valueDouble/100d;
                					else
                						return valueDouble;
                				} catch (NumberFormatException e) {
                					return null;
                				}
                			}
                		});
                		currencyType.register();
                Last edited by jay.l.fisher; 19 May 2011, 11:32.

                Comment


                  #9
                  Hi Jay
                  We don't have the homeCurrencyFormat methods but we're not reproducing this issue.
                  Our test case looks like this:
                  Code:
                          SimpleType currencyType = new SimpleType("currency", FieldType.FLOAT);
                          currencyType.setEditFormatter(new SimpleTypeFormatter() {
                  
                              @Override
                              public String format(Object value, DataClass field,
                                      DataBoundComponent component, Record record) {
                                  if (value==null) value = "0";
                                  Double valueDouble = Double.valueOf(value.toString());
                                  return "$" + valueDouble;// homeCurrencyFormat(valueDouble);
                              }
                          });
                          currencyType.setEditParser(new SimpleTypeParser() {
                  
                              @Override
                              public Object parseInput(String value, DataClass field,
                                      DataBoundComponent component, Record record) {
                                  if (value==null) value = "0";
                                  try {
                                      // Remove anything but digits and the decimal point
                                      String strippedValue = value.toString().replaceAll("[^0-9\\.]", "");
                                      Double valueDouble = Double.valueOf(strippedValue.length()==0 ? "0" : strippedValue);
                                     // if ("0".equals(IPGui.homeCurrencyDecimals))
                                      //    return valueDouble/100d;
                                      //else
                                          return valueDouble;
                                  } catch (NumberFormatException e) {
                                      return null;
                                  }
                              }
                          });
                          currencyType.register();
                  
                          DataSource ds = new DataSource();
                          ds.setID("testDS");
                          ds.setClientOnly(true);
                          
                          DataSourceField f1 = new DataSourceField();
                          f1.setName("f1");
                          f1.setType(FieldType.SEQUENCE);
                          f1.setPrimaryKey(true);
                          
                          DataSourceField customtype = new DataSourceSimpleTypeField("customtype", currencyType);
                          
                          ds.setFields(f1,customtype);
                          
                          final FilterBuilder fb = new FilterBuilder();
                          fb.setDataSource(ds);
                          fb.setTop(100);
                          fb.draw();
                          
                          Button b = new Button();
                          b.setTitle("Show Vals!");
                          b.addClickHandler(new ClickHandler() {
                              
                              @Override
                              public void onClick(ClickEvent event) {
                                  SC.say("" + new JSONEncoder().encode(fb.getCriteria().getJsObj()));
                                  
                              }
                          });
                          b.draw();
                  In this code with the latest mainline codebase we're able to select equals and enter a value for the special currency-based field and the criteria is populated as expected.
                  There have been various recent changes in this area so - can you try this test case against your current build. If it fails there, you probably just need to upgrade. Note: Get the *next* nightly build (May 20) rather than today's - we've made a fix in this area today. If our test case works against your build, it implies there's something specific about your application code that's causing things to fail and we may need to see a fuller test case (including that formatter definition, and the dataSource definition).

                  Comment


                    #10
                    SmartClient Version: SC_SNAPSHOT-2011-05-20/PowerEdition Deployment (built 2011-05-20)

                    I just tried today's build and it has the same problem. The homeCurrencyFormat() method is pretty simple. It just looks at a static variable to determine which NumberFormat to use.
                    Code:
                    	public static String homeCurrencyFormat(Double value) {
                    		if ("0".equals(IPGui.homeCurrencyDecimals))
                    			return NumberFormat.getFormat("0").format(value*100);
                    		else
                    			return NumberFormat.getFormat("#,##0.00").format(value);
                    	}
                    The way our test system is configured it will always choose the second format - "#,##0.00".

                    As far as the data source, it is happening on type="currency" fields in any data source. Here is an example of one. Selecting field PCDRPPN01 in the FilterBuilder and entering a criteria of "greater than 0.00" results in empty criteria being returned by FilterBuilder.getCriteria().

                    Code:
                    <DataSource ID="IPPCDTL" dataFormat="iscServer"
                    	serverType="sql" dbName="as400" sparseUpdates="true" tableName="IPPCDTL"
                    	serverConstructor="com.islandpacific.gui.server.customDataSource.IpDataSource">
                    	<!-- Price change detail file. -->
                    	<fields>
                    
                    		<field name="PCDRSSN" title="Session ID" type="integer" length="7" primaryKey="true" detail="true"/>
                    		<field name="PCDRSDQ" title="Sequence" type="integer" length="7" primaryKey="true" detail="true"/>
                    		
                    		<field name="ItemNumber" title="Item Number" type="text" width="180" required="true" 
                    			customSelectExpression="PCDRCLS||'-'||PCDRVEN||'-'||PCDRSTY|| CASE WHEN LENGTH(TRIM(PCDRCLR))>0 THEN '-' || PCDRCLR ELSE '' END || CASE WHEN LENGTH(TRIM(PCDRSIZ))>0 THEN '-' || PCDRSIZ ELSE '' END"/>
                    		<field name="PCDRINS" title="Description" type="text" length="25"/>
                    		<field name="PCDRFDT" title="From Date" type="date"/>
                    		<field name="PCDRTDT" title="To Date" type="date"/>
                    		<field name="PCDRCAL" title="Method" type="text" length="1" width="100">
                    			<valueMap>
                    				<value ID="1">New Price</value>
                    				<value ID="2">New Markup</value>
                    				<value ID="3">Percent Off</value>
                    				<value ID="4">Amount Off</value>
                    			</valueMap>
                    		</field>
                    		<field name="PCDRCUR" title="Currency" type="text" length="3" detail="true"/>
                    		<field name="PCDRSYM" title="Cur" type="text" length="2"/>
                    		<field name="PCDRDEC" title="Decimal Conversion" type="integer" length="3" hidden="true"/>
                    				
                    		<field name="PCDRPPR" title="Price Range By" type="text" length="1" detail="true" width="100">
                    			<valueMap>
                    				<value ID="1">Book</value>
                    				<value ID="2">Original</value>
                    				<value ID="3">Suggested</value>
                    				<value ID="4">PLU</value>
                    				<value ID="5">Alternate PLU</value>
                    				<value ID="6">Split Price</value>
                    				<value ID="7">Promotional</value>				
                    			</valueMap>
                    		</field>
                    		<field name="PCDRBAS" title="Base Retail" type="text" length="1" detail="true" width="100">
                    			<valueMap>
                    				<value ID="1">Book</value>
                    				<value ID="2">Original</value>
                    				<value ID="3">Suggested</value>
                    				<value ID="4">PLU</value>
                    				<value ID="5">Alternate PLU</value>
                    				<value ID="6">Split Price</value>
                    				<value ID="7">Promotional</value>				
                    			</valueMap>
                    		</field>	
                    
                    		<field name="PCDRDIV" title="Division" type="text" length="2" detail="true"/>
                    		<field name="PCDRDPT" title="Department" type="text" length="3" detail="true"/>
                    		<field name="PCDRSBD" title="Subdepartment" type="text" length="4" detail="true"/>
                    		<field name="PCDRCLS" title="Class" type="text" length="4" detail="true"/>
                    		<field name="PCDRVEN" title="Vendor" type="text" length="5" detail="true"/>
                    		<field name="PCDRSTY" title="Style" type="text" length="4" detail="true"/>
                    		<field name="PCDRCLR" title="Color" type="text" length="3" detail="true"/>
                    		<field name="PCDRSIZ" title="Size" type="text" length="4" detail="true"/>
                    		<field name="PCDREXT" title="IPEXTIT Record Key" type="text" length="10" hidden="true"/>
                    		
                    		<field name="PCDRTGB" title="Target Retail: Book" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGO" title="Target Retail: Original" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGG" title="Target Retail: Suggested" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGP" title="Target Retail: Plu" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGA" title="Target Retail: Alt Plu" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGS" title="Target Retail: Split" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRTGT" title="Target Retail: Promo/temp" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRSTB" title="IPSTRTB Record Key" type="text" length="10" hidden="true"/>
                    		<field name="PCDRFSL" title="Facility Selection Level" type="text" length="1" hidden="true"/>
                    		<field name="PCDRFSV" title="Facility Selection Value" type="text" length="5" hidden="true"/>
                    
                    				
                    		<field name="PCDRPPF01" title="Price Range From 1" type="currency" detail="true"/>
                    		<field name="PCDRPPF02" title="Price Range From 2" type="currency" detail="true"/>
                    		<field name="PCDRPPF03" title="Price Range From 3" type="currency" detail="true"/>
                    		<field name="PCDRPPF04" title="Price Range From 4" type="currency" detail="true"/>
                    		<field name="PCDRPPF05" title="Price Range From 5" type="currency" detail="true"/>
                    		<field name="PCDRPPF06" title="Price Range From 6" type="currency" detail="true"/>
                    		<field name="PCDRPPF07" title="Price Range From 7" type="currency" detail="true"/>
                    		<field name="PCDRPPF08" title="Price Range From 8" type="currency" detail="true"/>
                    		<field name="PCDRPPF09" title="Price Range From 9" type="currency" detail="true"/>
                    		<field name="PCDRPPF10" title="Price Range From 10" type="currency" detail="true"/>
                    		<field name="PCDRPPF11" title="Price Range From 11" type="currency" detail="true"/>
                    		<field name="PCDRPPF12" title="Price Range From 12" type="currency" detail="true"/>
                    		
                    		<field name="PCDRPPT01" title="Price Range To 1" type="currency" detail="true"/>
                    		<field name="PCDRPPT02" title="Price Range To 2" type="currency" detail="true"/>
                    		<field name="PCDRPPT03" title="Price Range To 3" type="currency" detail="true"/>
                    		<field name="PCDRPPT04" title="Price Range To 4" type="currency" detail="true"/>
                    		<field name="PCDRPPT05" title="Price Range To 5" type="currency" detail="true"/>
                    		<field name="PCDRPPT06" title="Price Range To 6" type="currency" detail="true"/>
                    		<field name="PCDRPPT07" title="Price Range To 7" type="currency" detail="true"/>
                    		<field name="PCDRPPT08" title="Price Range To 8" type="currency" detail="true"/>
                    		<field name="PCDRPPT09" title="Price Range To 9" type="currency" detail="true"/>
                    		<field name="PCDRPPT10" title="Price Range To 10" type="currency" detail="true"/>
                    		<field name="PCDRPPT11" title="Price Range To 11" type="currency" detail="true"/>
                    		<field name="PCDRPPT12" title="Price Range To 12" type="currency" detail="true"/>
                    
                    		<field name="PCDRPPN01" title="New Price" type="currency"/>
                    		<field name="PCDRPPN02" title="New Price 2" type="currency" detail="true"/>
                    		<field name="PCDRPPN03" title="New Price 3" type="currency" detail="true"/>
                    		<field name="PCDRPPN04" title="New Price 4" type="currency" detail="true"/>
                    		<field name="PCDRPPN05" title="New Price 5" type="currency" detail="true"/>
                    		<field name="PCDRPPN06" title="New Price 6" type="currency" detail="true"/>
                    		<field name="PCDRPPN07" title="New Price 7" type="currency" detail="true"/>
                    		<field name="PCDRPPN08" title="New Price 8" type="currency" detail="true"/>
                    		<field name="PCDRPPN09" title="New Price 9" type="currency" detail="true"/>
                    		<field name="PCDRPPN10" title="New Price 10" type="currency" detail="true"/>
                    		<field name="PCDRPPN11" title="New Price 11" type="currency" detail="true"/>
                    		<field name="PCDRPPN12" title="New Price 12" type="currency" detail="true"/>
                    		
                    		<field name="PCDRPPM01" title="Markup" type="float"/>
                    		<field name="PCDRPPM02" title="Markup 2" type="float" detail="true"/>
                    		<field name="PCDRPPM03" title="Markup 3" type="float" detail="true"/>
                    		<field name="PCDRPPM04" title="Markup 4" type="float" detail="true"/>
                    		<field name="PCDRPPM05" title="Markup 5" type="float" detail="true"/>
                    		<field name="PCDRPPM06" title="Markup 6" type="float" detail="true"/>
                    		<field name="PCDRPPM07" title="Markup 7" type="float" detail="true"/>
                    		<field name="PCDRPPM08" title="Markup 8" type="float" detail="true"/>
                    		<field name="PCDRPPM09" title="Markup 9" type="float" detail="true"/>
                    		<field name="PCDRPPM10" title="Markup 10" type="float" detail="true"/>
                    		<field name="PCDRPPM11" title="Markup 11" type="float" detail="true"/>
                    		<field name="PCDRPPM12" title="Markup 12" type="float" detail="true"/>
                    		
                    		<field name="PCDRPPP01" title="% Off" type="float"/>
                    		<field name="PCDRPPP02" title="% Off 2" type="float" detail="true"/>
                    		<field name="PCDRPPP03" title="% Off 3" type="float" detail="true"/>
                    		<field name="PCDRPPP04" title="% Off 4" type="float" detail="true"/>
                    		<field name="PCDRPPP05" title="% Off 5" type="float" detail="true"/>
                    		<field name="PCDRPPP06" title="% Off 6" type="float" detail="true"/>
                    		<field name="PCDRPPP07" title="% Off 7" type="float" detail="true"/>
                    		<field name="PCDRPPP08" title="% Off 8" type="float" detail="true"/>
                    		<field name="PCDRPPP09" title="% Off 9" type="float" detail="true"/>
                    		<field name="PCDRPPP10" title="% Off 10" type="float" detail="true"/>
                    		<field name="PCDRPPP11" title="% Off 11" type="float" detail="true"/>
                    		<field name="PCDRPPP12" title="% Off 12" type="float" detail="true"/>
                    		
                    		<field name="PCDRPPA01" title="Amount Off" type="currency"/>
                    		<field name="PCDRPPA02" title="Amount Off 2" type="currency" detail="true"/>
                    		<field name="PCDRPPA03" title="Amount Off 3" type="currency" detail="true"/>
                    		<field name="PCDRPPA04" title="Amount Off 4" type="currency" detail="true"/>
                    		<field name="PCDRPPA05" title="Amount Off 5" type="currency" detail="true"/>
                    		<field name="PCDRPPA06" title="Amount Off 6" type="currency" detail="true"/>
                    		<field name="PCDRPPA07" title="Amount Off 7" type="currency" detail="true"/>
                    		<field name="PCDRPPA08" title="Amount Off 8" type="currency" detail="true"/>
                    		<field name="PCDRPPA09" title="Amount Off 9" type="currency" detail="true"/>
                    		<field name="PCDRPPA10" title="Amount Off 10" type="currency" detail="true"/>
                    		<field name="PCDRPPA11" title="Amount Off 11" type="currency" detail="true"/>
                    		<field name="PCDRPPA12" title="Amount Off 12" type="currency" detail="true"/>
                    		
                    		<field name="PCDRPPS01" title="Start At 1" type="currency" detail="true"/>
                    		<field name="PCDRPPS02" title="Start At 2" type="currency" detail="true"/>
                    		<field name="PCDRPPS03" title="Start At 3" type="currency" detail="true"/>
                    		<field name="PCDRPPS04" title="Start At 4" type="currency" detail="true"/>
                    		<field name="PCDRPPS05" title="Start At 5" type="currency" detail="true"/>
                    		<field name="PCDRPPS06" title="Start At 6" type="currency" detail="true"/>
                    		<field name="PCDRPPS07" title="Start At 7" type="currency" detail="true"/>
                    		<field name="PCDRPPS08" title="Start At 8" type="currency" detail="true"/>
                    		<field name="PCDRPPS09" title="Start At 9" type="currency" detail="true"/>
                    		<field name="PCDRPPS10" title="Start At 10" type="currency" detail="true"/>
                    		<field name="PCDRPPS11" title="Start At 11" type="currency" detail="true"/>
                    		<field name="PCDRPPS12" title="Start At 12" type="currency" detail="true"/>
                    		
                    		<field name="PCDRPPE01" title="Round At 1" type="currency" detail="true"/>
                    		<field name="PCDRPPE02" title="Round At 2" type="currency" detail="true"/>
                    		<field name="PCDRPPE03" title="Round At 3" type="currency" detail="true"/>
                    		<field name="PCDRPPE04" title="Round At 4" type="currency" detail="true"/>
                    		<field name="PCDRPPE05" title="Round At 5" type="currency" detail="true"/>
                    		<field name="PCDRPPE06" title="Round At 6" type="currency" detail="true"/>
                    		<field name="PCDRPPE07" title="Round At 7" type="currency" detail="true"/>
                    		<field name="PCDRPPE08" title="Round At 8" type="currency" detail="true"/>
                    		<field name="PCDRPPE09" title="Round At 9" type="currency" detail="true"/>
                    		<field name="PCDRPPE10" title="Round At 10" type="currency" detail="true"/>
                    		<field name="PCDRPPE11" title="Round At 11" type="currency" detail="true"/>
                    		<field name="PCDRPPE12" title="Round At 12" type="currency" detail="true"/>
                    		
                    		<field name="PCDRNSQ" title="New Split Quantity" type="integer" length="3" detail="true"/>
                    		<field name="PCDRMIL" title="Merch Instruction Level" type="text" length="1" detail="true"/>
                    		<field name="PCDRFIL" title="Facility Instruction Level" type="text" length="1" detail="true"/>
                    		<field name="PCDRMLV1" title="Merch Level Varies 1" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV2" title="Merch Level Varies 2" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV3" title="Merch Level Varies 3" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV4" title="Merch Level Varies 4" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV5" title="Merch Level Varies 5" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV6" title="Merch Level Varies 6" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV7" title="Merch Level Varies 7" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMLV8" title="Merch Level Varies 8" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRSKU" title="Short Sku Number" type="integer" length="10" detail="true"/>
                    		<field name="PCDRISB" title="Isbn Number" type="text" length="10" detail="true"/>
                    		<!--<field name="PCDROPN1" title="Unused" type="text" length="12"/>-->
                    		<!--<field name="PCDROPN2" title="Unused" type="text" length="13"/>-->
                    		<field name="PCDRVST" title="Vendor Style Number" type="text" length="15" detail="true"/>
                    		<field name="PCDRPLU" title="Plu Record Type" type="text" length="1" detail="true"/>
                    		<field name="PCDRILL" title="Illustrated" type="text" length="1" detail="true"/>
                    		<field name="PCDRPAG" title="Page Number" type="integer" length="3" detail="true"/>
                    		<field name="PCDRLOC" title="Location Within Page" type="text" length="2" detail="true"/>
                    		<field name="PCDRCOU" title="Coupon Required" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRMAN" title="Manifests Printed Yet" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRDWN" title="Downloaded To Plu File" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRAPY" title="Applied To Item Master" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRPRO" title="P=processed" type="text" length="1" detail="true"/>
                    		<field name="PCDRGEN" title="Is This A General Markdown" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRDES" title="Description" type="text" length="25" detail="true"/>
                    		<field name="PCDREID" title="Promo Event Id" type="text" length="8" detail="true"/>
                    		<field name="PCDRPMF" title="Price Modeling Flag" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<field name="PCDRPPU" title="Price Point Range: Used" type="boolean" sqlStorageStrategy="singleCharYN" detail="true"/>
                    		<!--<field name="PCDR##1" title="Available" type="text" length="12"/>-->
                    		<field name="PCDRGTIN" title="Gtin" type="text" length="14" detail="true"/>
                    		<field name="PCDRGTINTP" title="Gtin Type" type="text" length="1" detail="true"/>
                    	</fields>
                    </DataSource>

                    Comment


                      #11
                      Any news on this?

                      Comment


                        #12
                        Hi Jay,

                        Right now we seem to be in a "can't reproduce" state. Can you confirm that if you run the test case we provided, it works in your project?

                        It should not make a difference, but you might try adding your NumberFormat call to our test case.

                        Finally, you might try adding our definition of the "currency" SimpleType to your project (in lieu of your real definition) and see if it makes the problem go away when used with your DataSources.

                        Comment


                          #13
                          On closer examination using build SmartClient Version: SC_SNAPSHOT-2011-05-20/PowerEdition Deployment (built 2011-05-20) I'm finding that the filtering is working for these fields.

                          The problem is when we try to restore saved filter criteria and re-display it in the FilterBuilder. We're using JSONEncoder to encode the criteria to a string with setPrettyPrint(false) and then saving that String.

                          To restore the criteria we're using ...
                          Code:
                          JavaScriptObject criteriaJsObj = menuItem.getAttributeAsJavaScriptObject(FILTER_CRITERIA);
                          SC.logWarn("" + new JSONEncoder().encode(criteriaJsObj));
                          fb.setCriteria(new AdvancedCriteria(criteriaJsObj));
                          The logWarn shows the correctly restored criteria object.
                          Code:
                          09:00:18.180:MUP3:WARN:Log:{
                              "operator":"and", 
                              "criteria":[
                                  {
                                      "fieldName":"RetailOpen", 
                                      "operator":"greaterThan", 
                                      "value":1000
                                  }
                              ]
                          }
                          But when the FilterBuilder displays we see the criteria RetailOpen greaterThan but the value is 0.00, not the 1000 that was saved and restored.

                          Comment


                            #14
                            Is there a different EditFormatter used by the FilterBuilder which could explain why the value does not show up in the editor for these fields.

                            Comment


                              #15
                              We're checking for a criteria round-tripping problem. However, as far as your EditorFormatter, are you seeing it not being called when you apply criteria via setCriteria()? Are you see it called with the right value?

                              Comment

                              Working...
                              X