Hi,
We get data from vendor and import into table like this
TxID
BCode
Ecode
SType
SCode
Desc
12345
SR
SR
MF
Abc
This is one type
12346
SD
SD
MF
Bcd
One more type
12347
CC
SD
OF
Efg
New type
12348
SR
SR
MF
Xyz
I get multiple rows of data like this. I need to send data to front end application as follows.
--Setup table variable to hold Datamart results
DECLARE @Types TABLE
(
TxID smallint not null,
BCode varchar(5),
ECode varchar(5),
SType varchar(5),
SCode Varchar(10),
[Desc] varchar(50) null
)
INSERT INTO @Types (TXID, BCode, ECode, SType, SCode, [Desc])
SELECT 12345, 'SR', 'SR', 'MF', 'Abc', 'This is one type'
Union
SELECT 12345, 'SD', 'SD', 'MF', 'Bcd', 'This is one more type'
union
SELECT 12345, 'CC', 'SD', 'OF', 'Efg', 'New Type'
union
SELECT 12345, 'SR', 'SR', 'MS', 'xyz', 'This is one different type'
SELECT
CASE
WHEN BCode IN ('SR', 'SD') and SType = 'MF' THEN 'Fee'
WHEN BCode = 'CC' AND ECode = 'SD' AND SType = 'OF' THEN 'Fee'
ELSE BCode
END AS Type
From @Types
This result data gets showed up on front end page. On that page, user has type dropdown with different types from that application which has ‘Fee’ as value.
When user selects ‘Fee’ from dropdown, grid should refresh ‘Fee’ related rows. But we do not have ‘Fee’ type in back end. Above table has those.
How do I make filter work when Fee is sent as type to back end stored procedure which gets data from above table.
I have to implements similar logic for other types.