Hi All,
I have created a sql query but if I run it , I get this following error
"Id is an unknown attribute of AssetLocationStatus at GetClaimStatusChangeRequestList"
Please assist with the below query. Thanking you in advance
SELECT Distinct 'InstructionCode' = {Instruction}.[Code], 'Status' , 'AssetLocationStatus' = {AssetLocationStatus}.[Label], 'FromClaimStatus' = {InstructionClaimStatus}.[Id], 'ToClaimStatus' = {InstructionClaimStatus}.[Id], 'RequestedBy' = {User}.[Id], 'RequestedOn' = {ClaimStatusChangeRequest}.[RequestedOn] 'UpdatedBy' = {User}.[Id], 'UpdatedOn' = {ClaimStatusChangeRequest}.[ModifiedOn] from Instruction inner join {SalvageAsset} ON {Instruction}.[SalvageAssetId] = {SalvageAsset}.[Id] inner join {InstructionClaimStatus} ON {Instruction}.[InstructionClaimStatusId] = {InstructionClaimStatus}.[Id] inner join {ClaimStatusChangeRequest} ON {InstructionClaimStatus}.[Id] = {ClaimStatusChangeRequest}.[InstructionClaimStatusToId] inner join {User} ON {ClaimStatusChangeRequest}.[RequestedBy] = {User}.[Id] inner join {User} ON {ClaimStatusChangeRequest}.[ApprovedBy] = {User}.[Id] inner join {InstructionBusinessUnit} ON {Instruction}.[FMSBusinessUnitId] = {InstructionBusinessUnit}.[Id] inner join {AssetLocationStatus} ON {SalvageAsset}.[AssetLocationStatusId] = {AssetLocationStatus}.[Id] where {ClaimStatusChangeRequest}.[InstructionClaimStatusToId] IN (7,11) and {Instruction}.[Code] like '%' + @Search_Keyword + '%' or {Instruction}.[ClaimNumber] like '%' + @Search_Keyword + '%' or {Instruction}.[PolicyNumber] like '%' + @Search_Keyword + '%' and {ClaimStatusChangeRequest}.[RequestedBy] = @Search_RequestedBy or @Search_RequestedBy = 0 and {ClaimStatusChangeRequest}.[ApprovedBy] = @Search_ApprovedBy or @Search_ApprovedBy = 0 and {AssetLocationStatus}.[Id ]= @Search_AssetLocationStatusId or @Search_AssetLocationStatusId = 0 and {Instruction}.[FMSBusinessUnitId] = @Search_BusinessUnit or @Search_BusinessUnit = 0
It was complaining about the following:
{Instruction}.[Code] like '%' + @Search_Keyword + '%' or {Instruction}.[ClaimNumber] like '%' + @Search_Keyword + '%' or {Instruction}.[PolicyNumber] like '%' + @Search_Keyword + '%'
So I did it like this:
{Instruction}.[Code] like @Search_Keyword
{Instruction}.[ClaimNumber] like @Search_Keyword
Maybe remove this space:
thank you Daniel I got where the error is coming from , but it's giving me another error now saying "input string was not in a correct format " Please see below
{ClaimStatusChangeRequest}.[RequestedBy] = @Search_RequestedBy or @Search_RequestedBy= 0
If @Search_RequestedBy is of data type text then a string literal needs to be provided, the fact that you have condition set to =0 makes me assume you are providing numeric data
It is of data type User Identifier
That error message is then related to something else
Hi Zungu,
I tried a simpel case and it is okay:
Why not try first and see the executed sql?
regards
Hi Thandeka,
Can you please share the data types of your input parameters, and also the structure you are using as the output (attributes and data types)?
Thank you.
Best regards,
Paulo
Hi Paulo
Thank you so much I managed to resolve the error. Thank you.
Could you also share what fix you made to the SQL to resolve the problem?