I have downloaded and installed MemberExport v3.8.1 via nuget and it works great.
I'm following the example in the user manual to create a CheckboxValueParser but am receiving the error:
'MemberField' does not contain a definition for 'GetPrevalues' and no accessible extension method 'GetPrevalues' accepting a first argument of type 'MemberField' could be found (are you missing a using directive or an assembly reference?)
I have copied the code verbatim but updated the DataType GUID (should there be two attributes for 'PropertyEditorAlias'?):
using MemberExport.Library.Types;
using MemberExport.Library.ValueParsers;
using System.Text;
namespace Application.Core.Member.ValueParser
{
[ValueParser(PropertyEditorAlias = "fbaf13a8-4036-41f2-93a3-974f678c312a")]
[ValueParser(PropertyEditorAlias = "Umbraco.CheckBoxList")]
public class CheckboxValueParser : IValueParser
{
public virtual object Parse(object value)
{
return null;
}
public virtual object Parse(MemberField memberField, object value, FieldParserOptions fieldParserOptions)
{
if (value != null)
{
var sb = new StringBuilder();
foreach (string item in value.ToString().Split(','))
{
var prevalue = memberField.GetPrevalues().FindLast(p => p.Id.ToString() == item);
if (prevalue != null)
{
if (sb.Length > 0)
{
sb.Append(',');
}
sb.Append(prevalue.Value);
}
}
value = sb.ToString();
}
return value;
}
}
}
I've added a reference to MemberExport.Library. Am I missing another reference?
Can only think that it returns infor from wrong column. What is the result of the following query? That is when Memberexport determines which column to use.
select dbType from umbracoDataType where nodeId = 126
About to go offline until Tuesday so sorry for any delays in reply.
This was due to a bug in the Core of memberexport where the checkboxlist items got parsed but not the JSON value. That is fixed in release below. You don't need a custom provider for this anymore.
I downloaded and installed the package and removed my custom provider. The values are now being output but it doesn't look like the csv values are being quoted correctly.
I would be expecting the raw txt file to look like this:
Id,How can we contact you
1360,"Phone,Email,App notification,Pigeon,Post"
Hope that helps.
Will you be releasing this as an update to the Nuget package?
Hey Richard - hope all is ok. The documentation for MemberExport still refers to memberField.GetPrevalues() - could do with updating that example as i've run into the same issue trying to get the code working
CheckboxValueParser example not working
Hi
I have downloaded and installed MemberExport v3.8.1 via nuget and it works great.
I'm following the example in the user manual to create a CheckboxValueParser but am receiving the error:
I have copied the code verbatim but updated the DataType GUID (should there be two attributes for 'PropertyEditorAlias'?):
I've added a reference to MemberExport.Library. Am I missing another reference?
Thanks for your help.
Hi Neil,
I should have updated the sample. Items are stored as JSON these days. I think you can just use value.ToString().Split(',')
Hope this helps.
Richard
I should have debugged the value...
Having done so, I can see that the value always returns empty: Even though the value is being recorded in the database correctly:
Any idea why the value would always be empty???
Thanks
Weird,
Can only think that it returns infor from wrong column. What is the result of the following query? That is when Memberexport determines which column to use.
select dbType from umbracoDataType where nodeId = 126
About to go offline until Tuesday so sorry for any delays in reply.
Best,
Richard
There is no result!
Sorry must been the other id 1373
Updated with the DatatypeNodeId (1373):
That looks ok, No idea why it didn't retrieve the data then. Will come back to this next week.
Hi,
This was due to a bug in the Core of memberexport where the checkboxlist items got parsed but not the JSON value. That is fixed in release below. You don't need a custom provider for this anymore.
https://www.dropbox.com/s/j7xwa2njen3v41u/memberexport38_2.zip?dl=0
Hope this helps,
Richard
Hi Richard,
Thanks for looking into this and getting back to me.
I'll try out the release later today and let you know how it goes! Great that I won't need a custom provider :-)
Thanks
Hi Richard,
I downloaded and installed the package and removed my custom provider. The values are now being output but it doesn't look like the csv values are being quoted correctly.
I would be expecting the raw txt file to look like this:
Hope that helps.
Will you be releasing this as an update to the Nuget package?
Ignore all that Richard!
I had forgotten to select the Text Indicator field!
Will you be releasing this as an update to the Nuget package?
Thanks for a great product!
Great and yes but need to test the whole update first.
Hey Richard - hope all is ok. The documentation for MemberExport still refers to memberField.GetPrevalues() - could do with updating that example as i've run into the same issue trying to get the code working
Cheers
Si
is working on a reply...