SlideShare a Scribd company logo
1 of 12
3-15-2013
Bryan Mack
 Refer to the following 2 SQL scripts in SQL Developer:
 Query 1:
 Query 2:
The “academic_period” filter on the nested query limits the results.
In Cognos, we dynamically filter data based on
prompt values input by the user.
When using Custom SQL for a report’s source,
Cognos provides filters for us to filter data.
But what exactly is it filtering?
Our first SQL Script is embedded to Cognos as a
Query, minus the academic period:
Then a filter is added to the query via Cognos
If we use term 201320, and export our result set to
Excel, we can see that we have 12148 results
(the top 2 rows in Excel are header rows)
Keep that number in your mind – 12148…..
Let’s revisit slide 2’s results:
 Query 1:
 Query 2:
Shouldn’t we be limiting this to 2524 results? Cognos is not applying the filter
to the nested query
This is where Cognos Macros come in, we can
filter the prompt values wherever we desire:
Result of this query, exported to Excel: 2524 rows
The Cognos Macro has fixed the issue. To take
this further, I’d recommend, when using
Custom SQL, to keep all filters in one place,
even though the Cognos filter works on the
outer-most query, just to keep things clear:
compare dates
<field> = to_date(#prompt('parm_date')#,'yyyy-
mm-dd')
compare characters (equal)
<field> = #prompt('parm_multi_source')#
compare characters (in)
<field> IN (#promptmany('parm_carrier')#)
As we know, when optional prompts exist,
ignoring the prompt ignores the filter
altogether. However, if you have a macro
embedded, it will assume you selected nothing
and give you incorrect results.
You have to “trick” Cognos into treating a Macro
like an optional prompt
Method #1
and (
<field> IN
(#promptmany('parm_carrier','string',sq('NotSelected'))#)
OR
('NotSelected') in
(#promptmany('parm_carrier','string',sq('NotSelected'))#)
)
 Method #2
<field> IN
 (#promptmany('parm_carrier','string',’<field>’)#)
<field> =
to_timestamp(#prompt(‘parm_date')#,'YYYY-
MM-DD"T"HH24:MI:SS.ff3')
This syntax is necessary if you are using the
Cognos 10 provided date prompts, because
sometimes the values returned to the
parameters are in ISO 8601 format.

More Related Content

What's hot (19)

Understanding advanced blind sqli attack
Understanding advanced blind sqli attackUnderstanding advanced blind sqli attack
Understanding advanced blind sqli attack
 
Communication Diagram
Communication DiagramCommunication Diagram
Communication Diagram
 
Sequence Diagram
Sequence DiagramSequence Diagram
Sequence Diagram
 
E2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API Instruction
 
@elemorfaruk
@elemorfaruk@elemorfaruk
@elemorfaruk
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
SAS Macro
SAS MacroSAS Macro
SAS Macro
 
Accessing non static members from the main
Accessing non static members from the mainAccessing non static members from the main
Accessing non static members from the main
 
Composite Structure Diagram
Composite Structure DiagramComposite Structure Diagram
Composite Structure Diagram
 
Package Diagram
Package DiagramPackage Diagram
Package Diagram
 
Final project report
Final project reportFinal project report
Final project report
 
Murach: ASP.NET Core MVC, How To Work With Razor Views
Murach: ASP.NET Core MVC, How To Work With Razor ViewsMurach: ASP.NET Core MVC, How To Work With Razor Views
Murach: ASP.NET Core MVC, How To Work With Razor Views
 
Rrelational algebra in dbms overview
Rrelational algebra in dbms overviewRrelational algebra in dbms overview
Rrelational algebra in dbms overview
 
Ex
ExEx
Ex
 
26 Jo P Feb 09
26 Jo P Feb 0926 Jo P Feb 09
26 Jo P Feb 09
 
Lecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and ConstructorsLecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and Constructors
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
 
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design Pattern
 

Similar to Cognos Macros

PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckAndrey Karpov
 
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET Journal
 
maXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO StandardmaXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO StandardMax Kleiner
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingAndrey Karpov
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingPVS-Studio
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGlenn Gutmacher
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3Mahmoud Ouf
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challengesDhanu Srikar
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalM Malai
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerMydbops
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxBOSC Tech Labs
 
Architecting Wide-ranging Analytical Solutions with MongoDB
Architecting Wide-ranging Analytical Solutions with MongoDBArchitecting Wide-ranging Analytical Solutions with MongoDB
Architecting Wide-ranging Analytical Solutions with MongoDBMatthew Kalan
 
How "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersHow "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersChema Alonso
 
Cloudera Data Science Challenge
Cloudera Data Science ChallengeCloudera Data Science Challenge
Cloudera Data Science ChallengeMark Nichols, P.E.
 
Data Science Challenge presentation given to the CinBITools Meetup Group
Data Science Challenge presentation given to the CinBITools Meetup GroupData Science Challenge presentation given to the CinBITools Meetup Group
Data Science Challenge presentation given to the CinBITools Meetup GroupDoug Needham
 
Time-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy QueriesTime-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy QueriesChema Alonso
 
OXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART IOXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART IAbdul Rahman Sherzad
 

Similar to Cognos Macros (20)

PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd Check
 
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
 
maXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO StandardmaXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO Standard
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
 
Intake 37 linq2
Intake 37 linq2Intake 37 linq2
Intake 37 linq2
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challenges
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-final
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptx
 
Architecting Wide-ranging Analytical Solutions with MongoDB
Architecting Wide-ranging Analytical Solutions with MongoDBArchitecting Wide-ranging Analytical Solutions with MongoDB
Architecting Wide-ranging Analytical Solutions with MongoDB
 
Telecom Churn Analysis
Telecom Churn AnalysisTelecom Churn Analysis
Telecom Churn Analysis
 
Week 4
Week 4Week 4
Week 4
 
How "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersHow "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scanners
 
Cloudera Data Science Challenge
Cloudera Data Science ChallengeCloudera Data Science Challenge
Cloudera Data Science Challenge
 
Data Science Challenge presentation given to the CinBITools Meetup Group
Data Science Challenge presentation given to the CinBITools Meetup GroupData Science Challenge presentation given to the CinBITools Meetup Group
Data Science Challenge presentation given to the CinBITools Meetup Group
 
Time-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy QueriesTime-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy Queries
 
OXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART IOXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART I
 

More from Bryan L. Mack

Custom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseCustom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseBryan L. Mack
 
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...Bryan L. Mack
 
Oracle's Listagg Function - Uses and Duplicate Removal
Oracle's Listagg Function - Uses and Duplicate RemovalOracle's Listagg Function - Uses and Duplicate Removal
Oracle's Listagg Function - Uses and Duplicate RemovalBryan L. Mack
 
EDW PK Violation Troubleshooting Made Easy
EDW PK Violation Troubleshooting Made EasyEDW PK Violation Troubleshooting Made Easy
EDW PK Violation Troubleshooting Made EasyBryan L. Mack
 
SRP Implementation Success in a Complex Environment
SRP Implementation Success in a Complex EnvironmentSRP Implementation Success in a Complex Environment
SRP Implementation Success in a Complex EnvironmentBryan L. Mack
 
Oracle's ListAgg Function & Pertinent Use
Oracle's ListAgg Function & Pertinent UseOracle's ListAgg Function & Pertinent Use
Oracle's ListAgg Function & Pertinent UseBryan L. Mack
 

More from Bryan L. Mack (6)

Custom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseCustom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data Warehouse
 
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...
Extending the Admin UI: Proactively Preventing Poor BPRA Load/Refresh Perform...
 
Oracle's Listagg Function - Uses and Duplicate Removal
Oracle's Listagg Function - Uses and Duplicate RemovalOracle's Listagg Function - Uses and Duplicate Removal
Oracle's Listagg Function - Uses and Duplicate Removal
 
EDW PK Violation Troubleshooting Made Easy
EDW PK Violation Troubleshooting Made EasyEDW PK Violation Troubleshooting Made Easy
EDW PK Violation Troubleshooting Made Easy
 
SRP Implementation Success in a Complex Environment
SRP Implementation Success in a Complex EnvironmentSRP Implementation Success in a Complex Environment
SRP Implementation Success in a Complex Environment
 
Oracle's ListAgg Function & Pertinent Use
Oracle's ListAgg Function & Pertinent UseOracle's ListAgg Function & Pertinent Use
Oracle's ListAgg Function & Pertinent Use
 

Recently uploaded

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Cognos Macros

  • 2.  Refer to the following 2 SQL scripts in SQL Developer:  Query 1:  Query 2: The “academic_period” filter on the nested query limits the results.
  • 3. In Cognos, we dynamically filter data based on prompt values input by the user. When using Custom SQL for a report’s source, Cognos provides filters for us to filter data. But what exactly is it filtering?
  • 4. Our first SQL Script is embedded to Cognos as a Query, minus the academic period: Then a filter is added to the query via Cognos
  • 5. If we use term 201320, and export our result set to Excel, we can see that we have 12148 results (the top 2 rows in Excel are header rows) Keep that number in your mind – 12148…..
  • 6. Let’s revisit slide 2’s results:  Query 1:  Query 2: Shouldn’t we be limiting this to 2524 results? Cognos is not applying the filter to the nested query
  • 7. This is where Cognos Macros come in, we can filter the prompt values wherever we desire: Result of this query, exported to Excel: 2524 rows
  • 8. The Cognos Macro has fixed the issue. To take this further, I’d recommend, when using Custom SQL, to keep all filters in one place, even though the Cognos filter works on the outer-most query, just to keep things clear:
  • 9. compare dates <field> = to_date(#prompt('parm_date')#,'yyyy- mm-dd') compare characters (equal) <field> = #prompt('parm_multi_source')# compare characters (in) <field> IN (#promptmany('parm_carrier')#)
  • 10. As we know, when optional prompts exist, ignoring the prompt ignores the filter altogether. However, if you have a macro embedded, it will assume you selected nothing and give you incorrect results. You have to “trick” Cognos into treating a Macro like an optional prompt
  • 11. Method #1 and ( <field> IN (#promptmany('parm_carrier','string',sq('NotSelected'))#) OR ('NotSelected') in (#promptmany('parm_carrier','string',sq('NotSelected'))#) )  Method #2 <field> IN  (#promptmany('parm_carrier','string',’<field>’)#)
  • 12. <field> = to_timestamp(#prompt(‘parm_date')#,'YYYY- MM-DD"T"HH24:MI:SS.ff3') This syntax is necessary if you are using the Cognos 10 provided date prompts, because sometimes the values returned to the parameters are in ISO 8601 format.