It works great, exept for when I want to render out the selected values of a dropdown list using that prevalue source via the RecordField.ValuesAsString() method. When I do this, I just get the ID's of the prevalues rather than the actual string values. Is there something else I need to add to the PreValue source to do this?
I did try changing the ID filed to also be the same as the Value field, but that didn't work (The form just thought those fields weren't filled in for some reason).
Alright, have a look at the GetPrevalues methods here and see if that helps, I don't know the exact syntax but you are able to get both the value and the ID's.
Not sure if I'm readin it wrong, but based upon your suggestion, are you just recommending I pull back the entire list of pre values and do my own cross referecning rather than using the ValuesAsString() method?
Yes, if the ValuesAsString() method doesn't work for custom prevalue sources (sounds like a bug..) thne it would be fairly easy to just iterate through the prevalues and get match the selected values indexes you get back. Don't forget to load the settings either.
Hi Matt, how you get this work? I had same issue. for example, belowe the ValuesAsString() will only returen the prevalue sources ID not the value. Is a simple way to do this?
foreach
(RecordField rf in record.RecordFields.Values) { if (rf.Field.Caption == "#province"){ provinceTxt = rf.ValuesAsString(); } }
RecordField.ValuesAsString() and custom PreValue Source Type
Hey Guys,
I've implemented this Custom PreValue Source Type in my project:
http://www.nibble.be/?p=86
It works great, exept for when I want to render out the selected values of a dropdown list using that prevalue source via the RecordField.ValuesAsString() method. When I do this, I just get the ID's of the prevalues rather than the actual string values. Is there something else I need to add to the PreValue source to do this?
I did try changing the ID filed to also be the same as the Value field, but that didn't work (The form just thought those fields weren't filled in for some reason).
Anybody got any ideas on how to get this to work?
Cheers
Matt
You might need to load the settings for the prevalue field first.
No such luck I'm affraid. Still coming back as the Pre Value ID.
Matt
Alright, have a look at the GetPrevalues methods here and see if that helps, I don't know the exact syntax but you are able to get both the value and the ID's.
Not sure if I'm readin it wrong, but based upon your suggestion, are you just recommending I pull back the entire list of pre values and do my own cross referecning rather than using the ValuesAsString() method?
Yes, if the ValuesAsString() method doesn't work for custom prevalue sources (sounds like a bug..) thne it would be fairly easy to just iterate through the prevalues and get match the selected values indexes you get back. Don't forget to load the settings either.
Ok, I would have rather have gotten ValuesAsStrings to work, but the other method wasn't too hard to get working, and it does work, so job done.
Cheers
Matt
Hi Matt, how you get this work? I had same issue. for example, belowe the ValuesAsString() will only returen the prevalue sources ID not the value. Is a simple way to do this?
foreach
(RecordField rf in record.RecordFields.Values){ if (rf.Field.Caption == "#province"){ provinceTxt = rf.ValuesAsString(); } }
Hey Yan,
I ended up getting all the prevalues, and looping through them:
It's not the cleanest solution, but works for me.
Cheers
Matt
is working on a reply...