Documentation on working with collections from UI Model

I am looking for information on working with collections in VB or C# from the UIModel. I have an edit form spec with nested collections. I would like to be able to

  • Respond to when a field changes
  • No what the current value of a field is
  • Set the value in a field from VB \\ C#
  • Read definitions for each of the event handlers ( what's happening when it's called. )
  • Know what row I am working with
  • Refresh other elements on the row
  • Give focus to a specific row or control within a row.
  • Build a search field outside the collection which can be used to give focus to a specific row.

Is there a primary or documentation on collections and how they work? Documentation on the XML side is very good. I can’t find what I am looking for on the VB \\ C# side.

Comments

  • Ernest, great questions! There's no real documentation on this stuff anymore. A lot of it used to reside on the bbdevnetwork back when all of us worked at Blackbaud. This is hard to answer through a forum a lot of it is using standard .NET approaches to working with custom objects. Do you have a code sample that you can post?

  • Thanks Chris. My work is complicated by having no ability to debug. We use a shared DEV server, and I am unable to attach and debug. Peering into objects would be extremely helpful, otherwise, I have to guess, compile and push out a DLL.

    I think for preliminary questions

    I recently had some luck with the following bit of code.

    Private Sub _groupmembers_ActiveFieldChanged(sender As Object, e As ActiveFieldChangedEventArgs) Handles _groupmembers.ActiveFieldChanged
    For Each row In GROUPMEMBERS.Value
    If row.IsDirty = True Then
    Try

    DO COOL STUFF AND THINGS HERE
    Catch
    End Try
    End If

    Next
    End Sub

    So, based on the procedure name “_ActiveFieldChanged”, I think the event fires when we change focus. I am looping throw rows using “IsDirty” to figure out if something changed, then acting.

    So I am responding to when a field changes, but this feels sloppy. It seems to me there should be a way to work with when we change focus from one row to another. I'd like to sniff around the fields in that row, look at them, see what's in them an act. Maybe this is the best way.

    I have had some success setting fields with syntax like this

    row.LOOKUPID.Value = myUSRConstituent.LOOKUPID

    or this

    TrySetValueForFieldID(e.Model, CONSTITUENTLOOKUPID, myUSRConstituent.LOOKUPID)

    Depending on if I am in an edit form, batch handler, or import handler. So I think I am making progress, but I feel pretty blind. Without debugging or documentation, there is a ton of guesswork.

    I suppose understanding what the various default events truly mean would be helpful. There are about 10-12 default events in a batch handler, import handler or form and they are mostly clear, but I'm not 100% clear about where I am in the page lifecycle and the best place to hook in. My profound apologies for asking such fuzzy questions. I think there is tremendous power on the VB \\ C# side of things and I feel like I am just scratching the surface.

  • I'll respond to everything you have in another post, but wanted to say firstly that you should always and only ever develop locally for initial proof of concepts. Using a shared dev environment slows you by days and weeks at time for simple fixes.

  • Thanks Chris. Much appreciated. You are preaching to the choir on the local vs shared development. ;-) I am with you.

    On another note, I took a peek at your profile and noticed you are with Zuri group. I am 55% of the way through reviewing Expert Access for BBCRM by Zuri Group right now. Small world. :-)

  • Hello Ernest,

    So I've got a bit of experience working with XML data in C# so here's a small snippet that creates a fairly complex structure as it relates to Registrant Mappings for events.

    Blackbaud.AppFx.XmlTypes.DataForms.DataFormItemArrayValue value = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItemArrayValue()
    {
    Items = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItem[]
    {
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItem()
    {
    Values = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValueSet()
    {
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "REGISTRANTPACKAGEID", Value = RegistrantPackageId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "REGISTRATIONPACKAGEID", Value = RegistrationPackageId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "EVENTID", Value = EventId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "EVENTPRICEID", Value = EventPriceId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "REGISTRATIONSCOLLECTIONID", Value = RegistrationsCollectionId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "REGISTRANTREGISTRATIONMAPS", Value = RegistrantRegistrationMaps },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue()
    {
    ID = "REGISTRANTWAIVEBENEFITS",
    Value = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItemArrayValue()
    {
    Items = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItem[]
    {
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormItem()
    {
    Values = new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValueSet()
    {
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "EVENTID", Value = EventId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "WAIVEBENEFITS", Value = WaiveBenefits }
    }
    }
    }
    }
    },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "GUESTCONSTITUENTID", Value = GuestConstituentId },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "WAIVEREGISTRATIONFEE", Value = WaiveRegistrationFee },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "HASNOTIFICATIONS", Value = HasNotifications },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "TEAMFUNDRAISING", Value = TeamFundraising },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "PREFERENCES", Value = Preferences },
    new Blackbaud.AppFx.XmlTypes.DataForms.DataFormFieldValue(){ ID = "ONLINEREGISTRANT", Value = true }
    }
    }
    }
    };

    Obviously you'll need loops to iterate over anything that's an array. Let me know if this helps out or if you need me to give you more specific info.

    The biggest bit of advice I can give is to look at the request xml by querying the WSREQUESTLOG table and then look at how that is structured and try to mimic it.

  • Hey Steve,

    This looks great. I can't wait to dive in for a closer look. I'm comfortable with XML, particularly Blackbaud specs, and I'm pretty good at both C#, although we use VB where I work. This is going to be fantastic! I really appreciate it.

    Thank you,

    Ernie

Categories