Skip to content

Commit 7a099f7

Browse files
committed
Added GetModuleAreaByModuleId function.
Returns Area based on ModuleId.
1 parent 8e8a03d commit 7a099f7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
0 Bytes
Binary file not shown.

020_DIRECT_Framework/Direct_Framework/Direct_Framework.sqlproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
<Build Include="Functions\omd.GetFailedBatchIdList.sql" />
143143
<Build Include="Functions\omd.GetPreviousBatchInstanceDetails.sql" />
144144
<Build Include="Stored Procedures\omd.CreateLoadWindow.sql" />
145+
<Build Include="Functions\GetModuleAreaByModuleId.sql" />
145146
</ItemGroup>
146147
<ItemGroup>
147148
<PostDeploy Include="Scripts\Script.PostDeployment.sql" />
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
CREATE FUNCTION omd.GetModuleAreaByModuleId
2+
(
3+
@ModuleId INT -- The identifier of the Module (PK).
4+
)
5+
RETURNS VARCHAR(255) AS
6+
7+
-- =============================================
8+
-- Function: Get Module Area (by Id)
9+
-- Description: Takes the module id as input and returns the area code as registered in the framework
10+
-- =============================================
11+
12+
BEGIN
13+
-- Declare ouput variable
14+
15+
DECLARE @ModuleArea VARCHAR(255) =
16+
(
17+
SELECT module.AREA_CODE
18+
FROM omd.MODULE module
19+
WHERE MODULE_ID = @ModuleId
20+
)
21+
22+
SET @ModuleArea = COALESCE(@ModuleArea,'N/A')
23+
24+
-- Return the result of the function
25+
RETURN @ModuleArea
26+
END

0 commit comments

Comments
 (0)