Announcement

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

    Error when sorting formula fields

    Hello, we are seeing an error with formula fields where we can't sort them with SC 8.1. This is what we see in the dev console. Any idea what is going on?



    Code:
    00:35:11.050:MUP1:WARN:Log:TypeError: Object formulaField2 has no method 'getStandaloneFieldValue'
        unnamed() @ 
        unnamed()
        unnamed()
        ResultSet._doSort()
        ResultSet.setSort()
        ListGrid.setSort()
        ListGrid.headerClick()
        ListGrid._headerClick()
        itemClick()
        click()
        StatefulCanvas.handleActivate()

    #2
    Hard to even speculate with this little information - do you know if "formulaField2" is the name of one of the formula fields in the grid where this occurs? Or more generally, do you know where this identifier came from?

    Comment


      #3
      Yes, it is a formula field in a grid. The formulaField2 looks like that is how you guys generate identifiers for your formulaFields with this logic:

      Code:
      ,isc.A.getUniqueFieldName=function isc_FormulaBuilder_getUniqueFieldName(){return this.getNewUniqueFieldName("formulaField")}
      ,isc.A.getNewUniqueFieldName=function isc_FormulaBuilder_getNewUniqueFieldName(_1){if(!_1||_1=="")_1="field";var _2=this.getFields(),_3=1,_4=_1.length;for(var i=0;i<_2.length;i++){var _6=_2.get(i);if(_6.name.startsWith(_1)){var _7=_6.name.substr(_4),_8=new Number(_7);if(_8&&_8>=_3)_3=_8+1}}
      return _1+_3}
      So, here is how to recreate the problem. It appears to happen when there is a null value in a column being used in the formula builder.

      Go here: http://www.smartclient.com/#customColumns

      use this in the JS tab:

      Code:
      var ds = isc.DataSource.get("countryDS");
      
      isc.VLayout.create({
      	ID:"layout",
      	width:500, height:250,
      	members: [
      		isc.HLayout.create({
      			ID:"buttonLayout",
      			width:"*", height:30,
      			membersMargin: 10,
      			members: [
      				isc.IButton.create({
      				    ID: "formulaButton",
      				    autoFit: true,
      				    title: "Show Formula Builder",
      				    click: "countryList.data.getRange(0,countryList.data.getLength())[0].gdp=null;countryList.addFormulaField();"
      				}),
      				isc.IButton.create({
      				    ID: "summaryButton",
      				    autoFit: true,
      				    title: "Show Summary Builder",
      				    click: "countryList.addSummaryField();"
      				}),
      				isc.IButton.create({
      				    ID: "stateButton",
      				    autoFit: true,
      				    title: "Recreate from State",
      				    click: function () {
      				        var state = countryList.getFieldState(true);
      						countryList.destroy();
      						recreateListGrid();
      				        countryList.setFieldState(state);
      				    }
      				})
      			]
      		})
      	]
      });
      
      recreateListGrid();
      
      function recreateListGrid() {
      	layout.addMember(isc.ListGrid.create({
      	    ID: "countryList",
      	    width:"100%", height:"*",
      	    alternateRecordStyles:true, cellHeight:22,
      	    dataSource: ds,
      	    autoFetchData: true,
      	    canAddFormulaFields: true,
      	    canAddSummaryFields: true,
      	    fields:[
      	        {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", 
      	            imageURLSuffix:".png"
      	        },
      	        {name:"countryName", title:"Country"},
      	        {name:"capital", title:"Capital"},
      	        {name:"population", title:"Population", formatCellValue:"isc.Format.toUSString(value)"},
      	        {name:"area", title:"Area (km&sup2;)", formatCellValue:"isc.Format.toUSString(value)"},
      	        {name:"gdp", formatCellValue:"isc.Format.toUSString(value)"}
      
      
      	    ]
      	}));
      
      }
      After clicking "Try it", click "Show Formula Builder". I added logic there to null out the first row GDP when you click that button. Now, add a formula using GDP such as "C*2". Click Save. Next, try to sort by the New Field that was added and you should see that it is not sorting because this error is occurring behind the scenes. Interestingly, you can also set that first row gdp to 0 and get the same problem. But, set it to something other than zero or null and do it again and sorting works fine.

      Comment


        #4
        We've added a null check to avoid this issue. The fix will show up in upcoming nightly builds on the 8.1 branch.

        Comment


          #5
          Thank you, is there any way to get a patch for this though? Or, do you plan to put out another stable release soon? We are hoping to push 8.1 out into our production environment soon and would need this fix before we did.

          Comment


            #6
            Right now if you download the 8.1 nightly build from smartclient.com/builds, it contains carefully considered fixes only, no new features. So we'd recommend just going with that.

            Comment


              #7
              I see the nightly build of the Power Edition does not contain the js parser jar and the realtime messaging jar that we use. Should I assume that no changes have occurred to those 2 jars and we can keep using the 8.1 version? Or, are there fixes to either of those jars so I need to get a copy of them? If so, where do I find the nightlies for those jars?

              Comment


                #8
                If you're licensed for Messaging, you should see separate download links to get .zip files with the assets for that. If you don't, please send the account details.

                Comment


                  #9
                  Hi,

                  I thought I was just supposed to go to smartclient.com/builds to get it. But, I just logged in and went to the nightly PowerEdition page and saw a link to download the realtime messaging module. When I clicked the link

                  (http://www.smartclient.com/product/download-bounce.jsp?product=SMARTCLIENT&license=realtimemessaging&version=8.1), I got the following error:

                  An error has occurred when attempting to process your download request. Please contact Isomorphic Support to resolve this issue and to gain access to your licensed downloadable content.

                  Be sure to mention your account information (if any), the date and time of your download request, and the URL of this page.

                  This was at 12:49 AM PST.

                  Comment


                    #10
                    Sorry about that, the download service was recently upgraded and was barfing on your (very old) account. Please try again.

                    Comment


                      #11
                      Hi, it looks like the nightly build you asked me to download for this issue was good in every way except that it didn't include ISC_FileLoader.js. That file is included in the 8.1 release we downloaded but not the 8-27-11 snapshot. I'm going to just copy the file over from 8.1 for now but wanted to let you know it was missing for some reason.

                      Comment

                      Working...
                      X