views:

18

answers:

1

A filter criteria parameter needs to be made available as a parameter for a web service that returns monthly summary of account data.

GetLedgerSummary(Fiscal Year, Fiscal Month, Filter) returns LedgerSummaryResponse

LedgerSummaryResponse contains Company Code, Account Code, Fiscal Year, Fiscal Month and amount.

How should the “Filter” criteria should be designed so that I can limit the query response to a selected set of “Company Codes” and “Account Codes”, and it is easy for the end users to consume the web service for reporting?

The approach that I am considering is to have “Company Codes” and “Account Codes” properties for Filter object that accepts any delimited string of filter values.

Any links to definition filter criteria of similar web services would be highly helpful.

+1  A: 

I think you are on the right track, you want your callers to be able to filter the LedgerSummaryResponse by the Company Code and the Account Code. There are two options really, one is yours, which would be something to the effect of:

GetLedgerSummary(int year, int month, string [] companyCodes, string [] accountCodes)
{
  // You would implement logic to filter the codes 
}

The other option would be to build an enumeration and expose this as a KnownType so the users could only pass you valid values, but most likely the company codes and account codes are stored in some kind of datastore so this might not be practical. I would say the initial approach you've described should work. I guess the invalid company/account codes could be ignored.

RandomNoob
Thanks for validating the approach.
Ajit Singh