Data form collection fields for Constituent Attributes
Hi all,
How does one create a collection field for Constituent Attributes for a data form, respecting the type of the Value field? So far I have the following draft code.
If someone also has the SQL code to use the resulting data and insert it into the relevant Attribute tables, that would also be handy. I've not really thought about that yet, although I'm roughly familiar with the structure of Attribute tables.
Thanks in advance for any help,
David.
<FormField FieldID="ATTRIBUTES" DataType="XML" Caption="Attributes" CaptionResourceKey="$$attributes">
<Collection>
<Fields>
<FormField FieldID="CATEGORY" DataType="Guid" Caption="Category" CaptionResourceKey="$$category">
<SimpleDataList SimpleDataListID="958132a3-762a-4844-b7a1-f3a3098da95a">
<Params>
<Param ID="RECORDTYPE">
<Value>CAEDEB25-69A4-47BF-A8A3-9D6DD1577129</Value> <!-- Constituent -->
</Param>
</Params>
</SimpleDataList>
</FormField>
<FormField FieldID="VALUE" DataType="String" Caption="Value" CaptionResourceKey="$$value" />
<FormField FieldID="STARTDATE" DataType="Date" Caption="Start Date" CaptionResourceKey="$$start_date" />
<FormField FieldID="ENDDATE" DataType="Date" Caption="End Date" CaptionResourceKey="$$end_date" />
<FormField FieldID="COMMENT" DataType="String" Caption="Comment" CaptionResourceKey="$$comment" />
</Fields>
</Collection>
</FormField>
How does one create a collection field for Constituent Attributes for a data form, respecting the type of the Value field? So far I have the following draft code.
If someone also has the SQL code to use the resulting data and insert it into the relevant Attribute tables, that would also be handy. I've not really thought about that yet, although I'm roughly familiar with the structure of Attribute tables.
Thanks in advance for any help,
David.
<FormField FieldID="ATTRIBUTES" DataType="XML" Caption="Attributes" CaptionResourceKey="$$attributes">
<Collection>
<Fields>
<FormField FieldID="CATEGORY" DataType="Guid" Caption="Category" CaptionResourceKey="$$category">
<SimpleDataList SimpleDataListID="958132a3-762a-4844-b7a1-f3a3098da95a">
<Params>
<Param ID="RECORDTYPE">
<Value>CAEDEB25-69A4-47BF-A8A3-9D6DD1577129</Value> <!-- Constituent -->
</Param>
</Params>
</SimpleDataList>
</FormField>
<FormField FieldID="VALUE" DataType="String" Caption="Value" CaptionResourceKey="$$value" />
<FormField FieldID="STARTDATE" DataType="Date" Caption="Start Date" CaptionResourceKey="$$start_date" />
<FormField FieldID="ENDDATE" DataType="Date" Caption="End Date" CaptionResourceKey="$$end_date" />
<FormField FieldID="COMMENT" DataType="String" Caption="Comment" CaptionResourceKey="$$comment" />
</Fields>
</Collection>
</FormField>
0
Comments
-
Hey David,
I would suggest that you keep going with what you currently have and keep the VALUE set as a string as you can convert the values based off the CATEGORY value in your stored procedure that goes to insert the value into the table.
Here's how you'd work with it in sql:
SELECT
CATEGORY = Node.Data.value('(CATEGORY)[1]', 'uniqueidentifier'), VALUE = Node.Data.value('(VALUE)[1]','nvarchar')
, STARTDATE = Node.Data.value('(STARTDATE)[1]','datetime')
, ENDDATE = Node.Data.value('(ENDDATE)[1]','datetime')
, COMMENT = Node.Data.value('(COMMENT)[1]','nvarchar')
FROM @ATTRIBUTES.nodes('/ATTRIBUTES/ITEM') Node(Data)
And @ATTRIBUTES would be a parameter that your stored procedure takes in and has a type of xml. Essentially once you construct the collection (which is nothing more than xml) you just need to find a way to take that xml and parse the values back out into a tabular format.
One thing to note is that when you work with collections you're always going to have the ITEM in the Nodes structure because of the way CRM constructs the collections. Also you might need to play around with the sql datatypes and sizes in the query.
0 -
Dear Steven,
Thanks. That's helpful. I have it working now, doing as you suggest.
Kind regards,
David.0
Categories
- All Categories
- 6 Blackbaud Community Help
- 213 bbcon®
- 1.4K Blackbaud Altru®
- 403 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 656 Blackbaud Grantmaking™
- 577 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 939 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.6K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 249 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 241 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 794 Community News
- 3K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
