Problem with Calculated field when upgraded to 1.3

Mar 9, 2011 at 8:11 PM


I'm having trouble with making SLAM update SQL DB with correct data for Calculated field after upgrading from 1.2 to 1.3 version. When SLAM 1.2 was installed, the field in SQL table was capturing data in this format: "string;#City, State" (e.g. "string;#New York, NY"). Now, after upgrading to 1.3, the field data is captured in this format: "State".

This breaks all custom code, which uses SQL tables. The Calculated field has this formula. =IF(State<>".",CONCATENATE(City,", ",State),City)

Can someone help me to resolve this issue? Or, it lease suggest something. I'm really lost... :(

I'm afraid that someone will tell me to open SLAM source code and edit it... :(

Thank you!

Mar 10, 2011 at 5:41 PM

There was an update that parses calculated field values under the assumption that it would be easier to use, in this case, a string value with just the string instead of requiring consumers of that data to perform the parsing.  But as usual with such assumptions it seems that it has caused a problem for you, and I'm very sorry that is the case.  If you need the full text representation of the value again it will require a change.  I am working on other updates at the moment and can add an option to indicate whether the value should be parsed or not.  I'll let you know when an update containing that option is available, but for now you might either keep using 1.2 (which I don't personally recommend, but may be your only option if you can't change the code consuming this column) or, as you fear, comment out the lines 262 to 274 in SqlDataRepository.cs in the currently available code.

Mar 10, 2011 at 7:11 PM
Edited Mar 10, 2011 at 7:35 PM

Thank you brjenkins for your quick response! And, thanks for supporting this application for free, at least for us!

I now see why it doesn't save full text of the value. Yes, it will be nice to include an option for parsing, like you said. But I rather fix it temporarily for now as the other code is failing that depends on it. I downloaded the source code and opened in Visual Studio 2008. Then I tried to run in debug mode by inserting some break-points in ItemAdded/ItemDeleting, but it never caught the processes when I tried to add/delete items in slammed lists, though it updates the database. Do you know what to do to make debugging work? Although I am a developer, the code seems little tough for me, but I will be able to comment out those lines you mentioned, just need to make sure there are no other issues with the code compilation.



Mar 10, 2011 at 8:03 PM

If you're debugging it locally you should be able to just do attach to process and attach to the right w3wp process.  If you are trying to debug remotely, because the dlls are in the GAC and it won't load the symbols you would need to manually copy the pdb files into the assembly folder (need to unregister shfusion.dll to do so).  If you are having a problem debugging locally and you still think you need to debug something you can try adding the pdb files to the gac there.

Mar 10, 2011 at 8:19 PM

I'm trying to debug locally. I will try to add PDB files into GAC. Right now, I'm trying to build WSP, for which I compiled DLLs and then tried to run "createwsp.bat", but I got below error. Are there any steps to properly build the WSP? Thanks.

Copying DLL ...
4 File(s) copied
Copying Administration files ...
5 File(s) copied
Building WSP ...


Created by Carsten Keutmann
GPL License 2007

Building the solution - please wait
Saving the Manifest.xml file
Creating the WSP file
Could not load file or assembly 'CabLib, Version=, Culture=neutral, Publ
icKeyToken=85376ef9a48d191a' or one of its dependencies. An attempt was made to
load a program with an incorrect format.
Copying WSP file ...
1 File(s) copied


Mar 10, 2011 at 8:30 PM

I'm not sure what it is about putting the WSPBuilder files in source control...  replace the WSPBuilder folder with what is here:

Mar 10, 2011 at 8:42 PM

Oh man! The files are the same as the ones I used. BUT, the CabLib is for 32-bit machine, I am on 64-bit :). So, I downloaded 64-bit one from below location and it built WSP without errors.

Now, I have another question, sorry :). Are there any other things that would go wrong if I am deploying on 64-bit machine. I know I have another thread with similar problem that you know of, so please let me know if you know anything on both.

I will try to deploy and debug now...

Thanks a lot!


Mar 10, 2011 at 10:18 PM
Edited Mar 10, 2011 at 10:24 PM

Okay, I found the place where you changed it last time. It's not in "the lines 262 to 274 in SqlDataRepository.cs", but in "SPListItemExtender.cs" in AWS.SLAM.Core under SharePoint folder. Your new line was the one I commented out. Did you do this to resolve some issue? I hope not...Now, I got the Content Type Person field update problem in other thread. I will get there now...  

        public static Hashtable GetFieldValues(this SPListItem listItem, List<Field> outputFields)
            Hashtable values = new Hashtable();
            values.Add("ListItemID", listItem.UniqueId);
            values.Add("ListID", listItem.ParentList.ID);
            values.Add("ListRelativeID", listItem.ID);

            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(listItem))
                Field currentField = outputFields.Find(delegate(Field fieldToMatch) { return fieldToMatch.Name == property.Name; });

                if (currentField != null && !String.IsNullOrEmpty(currentField.Name) && !listItem.Fields.ContainsField(property.Name))
                //if (currentField != null && !String.IsNullOrEmpty(currentField.Name))
                    if (!values.ContainsKey(GetColumnName(currentField)))
                        values.Add(GetColumnName(currentField), property.GetValue(listItem) == null ? "" : property.GetValue(listItem).ToString());


Mar 10, 2011 at 10:32 PM

I'm not sure why that would have caused an issue with saving users based on your configuration.  The change here has to do with preferring the property value of the SPListItem over a field value if they overlap.  For instance, if I want to save Url or Name, where the property returns a calculated value, it's better to get that value then what would be returned from the overlapping field value.  I think you had Title in your configuration but that value is the same in both cases, so that is why I don't know what the interference would be.

Mar 10, 2011 at 10:47 PM

Do you mean saving Users issue from other thread? I'm going to leave some comments there soon based on what I found out just now.

Yes, you are right about Title, and sorry I didn't tell you. The Title column was renamed to State. I know I could make my code work based on that too, it's just too much to change when I can just comment out in your code.

Thank you very much for helping me out with this one!