1.7k questions

3.2k answers

1.7k comments

399 users

Categories

1.7k questions

3.2k answers

1.7k comments

399 users

0 votes

I am building a custom constituent tile and I have a collection / XML item that I am trying project on the view form. However, the form is not getting the collection items from the form load. I placed a dubbing script in the procedure and I can see the procedure passing the XML items every time the form loads but I don't get the values on the UI side.

Is there anything I am missing? I have attached both catalog and UI items.

<ViewDataFormTemplateSpec 
    xmlns="bb_appfx_viewdataformtemplate"
    xmlns:c="bb_appfx_commontypes"
    ID="d83a18d6-3693-40fb-bfc3-5b8ec68fa42a"
    Name="Sample Tile View Data Form"
    Description="A data form for viewing sample tile records"
    Author="Abel"
    DataFormInstanceID="98bded04-0a0d-4de5-86d8-8ae43d570072"
    RecordType="Constituent"
    c:SecurityUIFolder="Constituent\Summary"
    >

  
	<!-- define the SP that returns the data used by the form -->
	<SPDataForm SPName="USR_USP_DATAFORMTEMPLATE_VIEW_SAMPLETILE">
		<c:CreateProcedureSQL>
			<![CDATA[
alter procedure dbo.USR_USP_DATAFORMTEMPLATE_VIEW_SAMPLETILE
(
	@ID uniqueidentifier,
	@DATALOADED bit = 0 output,
	@MERGEDETAILS xml = null output

)
as
	set nocount on;
	-- be sure to set this, in case the select returns no rows
	select @DATALOADED = 1 from dbo.CONSTITUENT where ID = @ID;

	
--insert into BUGFINDER(ERRORDESCRIPTION) VALUES (convert(varchar(500),@MERGEDETAILS));



select @MERGEDETAILS = (
SELECT TOP 15 

	MERGEHISTORY.ID as ID
	, MERGEHISTORY.LOOKUPID as MERGELOOKUPID
	, MERGEHISTORY.DATEADDED as MERGEDATE
	, CA.USERNAME as MERGEDBY
FROM 
	CONSTITUENT MERGEHISTORY
	LEFT JOIN CHANGEAGENT CA ON MERGEHISTORY.ADDEDBYID = CA.ID
	
where MERGEHISTORY.ID = @ID
	
ORDER BY MERGEHISTORY.DATEADDED DESC
for xml raw('ITEM'),type,elements,root('MERGEDETAIL'),BINARY BASE64
);

set @DATALOADED = 1;
--insert into BUGFINDER(ERRORDESCRIPTION) VALUES (convert(varchar(500),@MERGEDETAILS));
return 0;
			]]>
		</c:CreateProcedureSQL>
	</SPDataForm>

	<!-- describe fields on the form, which correspond to parameters on the SP.  Note that system paramters 
	like the context @ID, @DATALOADED, and @CURRENTAPPUSERID need not be listed. -->
	<FormMetaData xmlns="bb_appfx_commontypes">
		<FormFields>
      <FormField FieldID="MERGEDETAILS" Hidden="true" DataType="XML" Caption="Merge Details">
        <Collection IDField="ID">
          <Fields>
            <FormField FieldID="ID" DataType="Guid" />
            <FormField FieldID="MERGELOOKUPID" DataType="String" />
            <FormField FieldID="MERGEDATE" DataType="Date" />
            <FormField FieldID="MERGEDBY" DataType="String" />
          </Fields>
        </Collection>
      </FormField>
		</FormFields>

        <WebUIComponent>
            <UIModel AssemblyName="SampleUIModel.dll" ClassName="SampleUIModel.SampleTileViewDataFormUIModel" />
            <WebUI>
                <ExternalResource Url="browser/htmlforms/custom/sampleuimodel/SampleTileViewDataForm.html" />
            </WebUI>
        </WebUIComponent>
  <UIFields>
    <FormField FieldID="MERGECOUNTER" DataType="String" Caption="NUMBERCOUNTER" />
    <FormField FieldID="LOOKUPID" DataType="String" Caption="Lookup Id" />
    <FormField FieldID="MERGEDBY" DataType="String" Caption="Merged By" />
    <FormField FieldID="MERGEDATE" DataType="Date" Caption="Merge Date" />
    <FormField FieldID="CURRENTMERGEID" DataType="Guid" Hidden="true" AvailableToClient="false" />
    <FormField FieldID="NOMERGE" Caption="No merge records" Hidden="true" DataType="String" />
  </UIFields>
   <UIActions>
     <UIAction ActionID="DUPLICATEANDMERGE" Caption="Duplicate and Merge">
       <ShowPage PageID="88159265-2b7e-4c7b-82a2-119d01ecd40f" TabID="5c057afa-92d3-43c8-a8c8-c7ab6a3cc988" SectionID="00000000-0000-0000-0000-000000000000" ForceReload="false">
         <ActionContext>FORM!ID</ActionContext>
       </ShowPage>
     </UIAction>
      <UIAction ActionID="MERGEFORWARD"></UIAction>
      <UIAction ActionID="MERGEBACKWARD"></UIAction>
   </UIActions>   
	</FormMetaData>

</ViewDataFormTemplateSpec>
Public Class SampleTileViewDataFormUIModel

Private Sub SampleTileViewDataFormUIModel_Loaded(ByVal sender As Object, ByVal e As Blackbaud.AppFx.UIModeling.Core.LoadedEventArgs) Handles Me.Loaded
    MERGECOUNTER.Value = MERGEDETAILS.Value.Count
End Sub

End Class

asked by abeldebela (232 points)
edited by abeldebela

1 Answer

0 votes

I found the problem, I had a different name of the XML root node from the form field id (MERGEDETAIL vs MERGEDETAILS).

answered by abeldebela (232 points)
...