WildCard Error in Application Definition File Error with custom application

I am trying to execute a application definition file through webpart .The filter has to be done based on UserID which is of Type Int64.

But it gives error as "A Wildcard filter requires a TypeDescriptor that resolves to a String:

Hence i tried to change the Filter descriptor to type Comparison and exactMatch ,Even then it did not work.

Following is the app def file

< xml version="1.0" standalone="yes" >

<LobSystem xmlns="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog" Name="GetTransactionLOBSystem" Version="1.0.0.0" Type="Database">

<Properties>

<Property Name="WildcardCharacter" Type="System.String">%</Property>

<!-- The Business Data Catalog uses the Wildcard character specified here with filter parameters.-->

</Properties>

<LobSystemInstances>

<LobSystemInstance Name="GetTransactionDetails">

<Properties>

<Property Name="DatabaseAccessProvider" Type="System.String">SqlServer</Property>

<Property Name="AuthenticationMode" Type="System.String">PassThrough</Property>

<Property Name="RdbConnection Data Source" Type="System.String">mlbp-0535</Property>

<Property Name="RdbConnection Initial Catalog" Type="System.String">Research</Property>

<Property Name="RdbConnection Integrated Security" Type="System.String">SSPI</Property>

<Property Name="RdbConnection Pooling" Type="System.String">False</Property>

</Properties>

</LobSystemInstance>

</LobSystemInstances>

<Entities>

<Entity EstimatedInstanceCount="0" Name="TransactionDetailsforUser">

<Identifiers>

<Identifier Name="UserID" TypeName="System.Int64" />

</Identifiers>

<Methods>

<Method Name="GetTransactionforUserID">

<Properties>

<Property Name="RdbCommandText" Type="System.String">Select AccountNumber,TransactionNumber,UserID,Amount,TransactionDate From dbo.TransactionDetails where UserID=@UserID</Property>

<Property Name="RdbCommandType" Type="System.Data.CommandType">Text</Property>

</Properties>

<FilterDescriptors>

<FilterDescriptor Type="Comparison" Name="UserID" >

</FilterDescriptor>

</FilterDescriptors>

<Parameters>

<Parameter Direction="In" Name="@UserID">

<TypeDescriptor TypeName="System.Int64" IdentifierName="UserID" AssociatedFilter="UserID" Name="UserID" />

</Parameter>

<Parameter Direction="Return" Name="dbo.Transactions">

<TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="dbo.TransactionsDataReader" IsCollection="true">

<TypeDescriptors>

<TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="dbo.TransactionsDataRecord">

<TypeDescriptors>

<TypeDescriptor TypeName="System.Int64" Name="TransactionNumber" />

<TypeDescriptor TypeName="System.Int64" Name="AccountNumber" />

<TypeDescriptor TypeName="System.Int64" IdentifierName="UserID" Name="UserID" />

<TypeDescriptor TypeName="System.DateTime" Name="TransactionDate" />

<TypeDescriptor TypeName="System.Int64" Name="Amount" />

</TypeDescriptors>

</TypeDescriptor>

</TypeDescriptors>

</TypeDescriptor>

</Parameter>

</Parameters>

<MethodInstances>

<MethodInstance Name="dbo.TransactionFinderforUser" Type="Finder" ReturnParameterName="dbo.Transactions" ReturnTypeDescriptorName="dbo.TransactionsDataReader" ReturnTypeDescriptorLevel="0" />

<MethodInstance Name="dbo.TransactionSpecificFinderforUser" Type="SpecificFinder" ReturnParameterName="dbo.Transactions" ReturnTypeDescriptorName="dbo.TransactionsDataReader" ReturnTypeDescriptorLevel="0" />

</MethodInstances>

</Method>

</Methods>

</Entity>

</Entities>

</LobSystem>

Following is the webpart code

LobSystem CrmSystem = ApplicationRegistry.GetLobSystems()["GetTransactionLOBSystem"];

LobSystemInstance CrmSysInstance = CrmSystem.GetLobSystemInstances()["GetTransactionDetails"];

Entity AccountEntity = CrmSysInstance.GetEntities()["TransactionDetailsforUser"];

FilterCollection fc = AccountEntity.GetFinderFilters();

FilterCollection newfc = new FilterCollection();

for(int i = 0; i < fc.Count; i++)

{

if (fcIdea.GetType().FullName == "Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter")

{

newfc.Add(fcIdea);

((WildcardFilter)newfc[0]).Value = "1";

}

}

IEntityInstanceEnumerator accountInstanceEnumerator = (IEntityInstanceEnumerator)AccountEntity.FindFiltered(newfc, CrmSysInstance);

while (accountInstanceEnumerator.MoveNext())

{

IEntityInstance Account = accountInstanceEnumerator.Current;

TableRow tableRow = new TableRow();

TableCell tableCell = new TableCell();

tableCell.Text = Account["TransactionNumber"].ToString();

tableRow.Cells.Add(tableCell);

MainTable.Rows.Add(tableRow);

}

}

catch (Exception ex)

{

throw ex;

}




Answer this question

WildCard Error in Application Definition File Error with custom application

  • magicalclick

    You can not apply a wildcard to an integer in a sql query, and since that is your only parameter you can not declare a finder. You can only declare a specific finder. Remove the method instance for finder. Additionally if you are going to have both a specific finder and a finder you should declare default values for the finder and specific finder for each parameter where you do not declare a default value for the finder for int parameters

    <Parameter Direction="In" Name="@GeneratedMaxIncidentID">

    - <TypeDescriptor TypeName="System.Int32" IdentifierName="IncidentID" AssociatedFilter="IncidentID" Name="IncidentID">
    - <DefaultValues>
    <DefaultValue MethodInstanceName="GetIncidentsFinderInstance" Type="System.Int32">9999999</DefaultValue>
    </DefaultValues>
    </TypeDescriptor>
    </Parameter>
    - <Parameter Direction="In" Name="@ReleaseName">
    - <TypeDescriptor TypeName="System.String" AssociatedFilter="ReleaseName" Name="ReleaseName">
    - <DefaultValues>
    <DefaultValue MethodInstanceName="GetIncidentsFinderInstance" Type="System.String">%</DefaultValue>
    <DefaultValue MethodInstanceName="GetIncidentsSpecificFinderInstance" Type="System.String">%</DefaultValue>
    </DefaultValues>
    </TypeDescriptor>
    </Parameter>


  • WildCard Error in Application Definition File Error with custom application