Dropdown values reurned as "string#...."

Nov 23, 2010 at 10:13 AM

Hello, thank you for a very useful set of functions.

I have been using SPCascadeDropdowns and SPDisplayRelatedInformation in combination on several SharePoint lists and libraries, currently to associate items with a defined work breakdown structure so that each item in a list item has a project reference, a work package reference and a task reference.  I now want to use these references as document properties within the associated MS Word document - so that the Work Breakdown Structure reference appears in the document.  The problem is that the references all appear in the word properties preceded by the tag "string#", i.e

  • SharePoint field is displayed as "CH.FN12"
  • MS Word property is displayed as "string#CH.FN12"

Can you offer any advice on how to solve this?  Many thanks.

VRS

Coordinator
Nov 23, 2010 at 1:53 PM

VRS:

Are you by any chance using a calculated column as a lookup value? See my post on this:
http://sympmarc.com/2009/10/09/sharepoint-lookup-column-based-on-a-calculated-column-woes/

Neither SPCascadeDropdowns nor SPDisplayRelatedInfo actually change any of the data values; they are just passed through or displayed.

M.

Nov 23, 2010 at 4:32 PM

Thank you for a very quick response, you have hit the problem on the head.

It is all to do with calculated fields.  The table for the Work Package reference, t_WPRefs, includes columns for:

  • WBS, e.g. 'CH.FN12.01'
  • Name - a string field
  • WP_Ref - a calculated field which returns the serial number of the work package, the last 2 digits of the WBS field, i.e. '01' in this case.

These fields are then referenced from a library of task sheets which uses the SPCascadeDropDowns function.  The task library contains a field LU_WPRef which is a look up to the WP_Ref field (the calculated field) in the table t_WPRefs.  The SPCascadeDropDowns function populates the dropdown with values from WBS (the full reference number) but returns the calculated value, WP_Ref.

The solution is therefore:

  • To change the look up from the task library to look at WBS, not WP_Ref thus returning the full WBS reference.
  • To add a (hidden) calculated field in the task library which does the calculation to return just the serial number extracted from the full WBS.  This calculated field provides the document property for MS Word.

Problem solved just by moving the calculation from the originating data source into the receiving library.

Thanks once again, VRS

 

 

Coordinator
Nov 23, 2010 at 5:00 PM

Awesome. Glad you solved it!

M.

Nov 24, 2010 at 5:36 PM

I came across the same issue, but rather than creating a new calculated column to "scrub" the information, used javascripts SPLIT method.  Works also to clean up and reorder date fields to match display, etc.

A simple example to remove the string# (or 5;# etc from a Person Group field) - this only works for single selectable columns (not multi select)

Say the return, myValue, is string#WhatIReallyWant

var myScrubbedValue= myValue.split("#")  //this yields two values myScrubbedValue[0] which is string# and myScrubbedValue[1] which is WhatIReallyWant

you can then just use myScrubbedValue[1] or set another variable equal to it - i.e. var myAnswer= myScrubbedValue[1]

 

Hope that helps!!