Advanced IQA: Business Objects, Queries, & More Tuesday, May 23rd3:30 PM – 4:30 PM
Denis Grey, Visual Antidote
• Process• Organizing and Securing Queries • The Source of all Data• Advanced IQA Tips and Techniques• Questions
Agenda
• Gather & Analyze reporting requirements • Determine/create data Sources • Create and name your IQA(s)• Create Filters • Select Display fields • Format display fields• Set security• Test• Deploy
Process
• Do we already have something similar? Where else will the organization need to use similar queries?
• Where is the data located in iMIS interface? How is it linked together?
• What filters are needed? • What columns do you need to display? Any sorting?
Process – Gather and Analyze
• Do other IQAs exist to access required data? Is there one close to what you are looking for in iMIS already?
• Are formulas, subtotals, levels of groupings, counts or averages needed?
• What type of joins are needed between data sources?
Process – Gather and Analyze
• Four kinds of IQAs– OOTB (out of the box) IQAs
• May need to be adjusted and improved• Always copy OOTB version and customize
– Web Queries• "Automatic" IQAs for reporting and navigation (e.g. Group definitions)
– My Organization's queries• Special-purpose reporting
– Utility queries• Lookups• Data sources for other queries• Dynamic queries
Organizing and Securing Queries
• Value Lists– $/Common/Queries/ValueLists
• Contact Search– $/ContactManagement/DefaultSystem/Queries/Contacts
• Samples– $/Samples/Events– $/Samples/Charts– $/Samples/Progress Tracker– $/Samples/Dashboard
• Your Org Folder– Keep your custom pieces together
Key Folders
• You can restrict who can view or access queries by selecting specific groups under the ‘Security’ tab.– Share (Everyone)– Private– Advanced
• "Custom" allows you to define access via an IQA!
• Pro tip: – If you want a query to display to everyone check that "Share
(Everyone)" is enabled
Securing Queries
• Basic Mode – Define sources + filters +
what to display – Run or Run as Report
• Advanced Mode – More complex formulas, logic – Aggregate criteria & display – SQL Expressions in queries
• Defined per user, setting retained between sessions• Pro tip:
– Always use "Advanced"
Basic vs Advanced Mode
• Vote now!– Barack Obama– Big O– Business Opportunity– Build Order– Business Object– Blocking Oscillator
What is a BO?
• Predefined or custom abstractions of iMIS database table(s) and/or view(s)
• Think "iMIS Action Views"• Example:
– Predefined CsContactBusiness Object represents a Customer record (uses Name, Name_Fin tables)
– Exposes Name Table details but also shows Name_Fin data including "RENEWED_THRU"
Business Objects
• Allows ASI to adjust, change or remove underlying tables without affecting IQAs and reports– e.g. "MEET_MASTER" becomes "EventMaster" in 2019
• Business Objects are SQL Views; views are automagically optimized for performance by SQL Server
• Improved compatibility between iMIS 100/200/300• Add features, lookups, formatting details and define them
to your organization's preferences• Automatically extends iMIS security and .NET compatibility
to fields and displays
Why Use a "Business Object"?
• Hundreds of pre-built Business Objects • Can create your own custom objects • How do designers figure out which Business Objects to
use? – Edit/Review BO in designer – Create a simple IQA and look at summary SQL – Check underlying fields, tables, views – Naming standards – many objects start with ‘Cs’ - example
‘CsDemo’
• See handy Business Object Cheat Sheet for key BOs and how they are used
Which ones to use?
• Business objects are created using iMIS tables and views as the source, and the business object is then used as the source in IQAs – BOs can include all fields for table/view or only specific fields – Filters can be added within the business object or IQA to only
include specific records. – Value lists can be added to field properties to create a look-up list in
the IQA
Creating Business Objects
•
Settings and Best Practices – Definition
• Never, ever bring over "TimeStamp" • Turning off "Allows Null" forces an entry• Use "Log all Changes" to add information to Change Log• "Available to Query Builder" makes field available to IQA• "Automatically Include in Queries" adds field to default list when
business object is chosen
Settings and Best Practices –Properties/Definition
Settings and Best Practices –Properties/Display
• Display Control• User defined mask• Hint, watermark text
• Prompt for field• Tool Tip• Format regular expression
• Options– Freeform data entry– Query Object– Value List (hard-coded)
• Query Object – $/Common/Value Lists– Code = Value in table– Provides dropdown list for IQAs
Settings and Best Practices –Properties/Values
• Tables– Pick business objects when available instead of tables
• Used columns– The more the merrier, never, ever use "TimeStamp"
• Filter Expression– SQL express to limit scope of business object:
(e.g. ACTIVITY_TYPE='COMMITTEE')
• Joins– Define simple or complex joins if using more than one table
• Key question – filter/join on Business Object or IQA?
Setting and Best Practices – Database
• When using more than one data source, a ‘Relationship’ has to be added to join the sources.
• Most Common Joins – Equals - All records where field in both sources match – Left join - All records in first source and only the matching records
in the second source – Not exists – All records in the second source that don’t exists in the
first source
Joins on Business Objects and IQAs
• Extensive documentation available:http://help.imis.com/20.2_Interim_Update/Features/RiSE/Business_Objects/Business_Objects.htm
• Watch for changes as iMIS evolves• Use Versions to recover / restore
damaged business objects• Roll your own for all user defined
tables so you can control formatting and business rules
Business Objects Summary
IQAs
Business Object
Tablesand
Views
• Query-building tool provided with IMIS • Simple access to iMIS data for reporting, mailings, or letter
and email merges• Provides the ability to create sophisticated queries against
the iMIS database • IQA simplifies query-building tasks by providing a
user-friendly* interface that allows users with limited SQL experience to build queries and reports.
* Your kilometerage may vary
IQA (Intelligent Query Architect)
• Used for many elements in user interface and drive most reports
• Three main options:– Query Menu – Single IQA– Query Menu – Multiple IQAs as report Group– Summary Display – Show one record's results
• Also– Query Chart Viewer– Related Items (Profile or Product pictures)– Communication Templates
IQAs in RiSE
• Create complex Business Objects• Summary options• Setting sources and joins• Filters• Display• Sorting• Using SQL to enhance format and function
Advanced IQA Techniques
Summary Options
Sources
• Dynamic filters:– @SelectedUser / @SubjectContact – Logged in or on behalf of– @LoggedInUser / @Me – Logged in only– @SelectedID – ID from URL or session– @Date / @Now – Today's Date– @url: - Any value in URL
Filters
• Function – Count, Max, Min, Sum, Avg• Alias – Changes name of column• Link – Changes field to hyperlink• Subtotal – creates hierarchical display
Display
• Shortcut (preferred method)– ~/MyShortcutContent record NEW– ~/MyShortcut or ContentCode=MyContentCode (deprecated)
• Navigation item– ~/MyShortcut NEW or – NavigationCode=MyNavigationCode&URLParameter1Name=[PropertyName]
• .ASPX page in your site~/Webpage.aspx&URLParameterName=[AliasName]
• Dynamically populated page (combo)– ~/MyShortcut&URLParameter1Name=[Alias
Name]&URLParameter2Name=URLParam2Value
Display – Link Options
• Straightforward• Field must be in query to be sorted upon• Pro Tip:
– Use "key_" or "code_" alias to allow a sort field to be available but not display on the query
Sorting
• Key is understanding your data• Things to look for:
– Right status codes (Active only?)– Date ranges– What if something is blank or null? In or out?– Correct joins (Left join = "Show a record for everything")
• Sanity check on new queries– Number of records returned should be OK– Totals should make sense– Copy IQA to SQL to test / examine
Accuracy in Reporting
• Powerful option for making IQAs even more useful
• Web searches are a powerful helper e.g. "SQL format date example"
Working with SQL
• Format dates• Format numbers• Convert carriage returns to line breaks• Add color (or colour) to output• Add HTML to output• Add images to output• Add case statements (if/else) to output
Custom SQL in IQAs
• Remove the time portion of a date field*• Format the date field to a different output type*• Remove the decimal and trailing zeros from an Order
Number• Truncate an email address• Convert a string to upper case• Replace portions of a string with another string• Add strings to create a new string
* this can also be done at the Business Object level
Things you can do with SQL
• Count records • Creating sub-totals • Adding links • Date filters*• Adding parameters • Multiple filter groups
* this can also be done at the Business Object level
And more…
• Most SQL string formatting functions should work– LTRIM(), RTRIM() – trim from left or right of text– CHARINDEX() – starting position of a string in another– PATINDEX() – works like “LIKE” – STUFF() – Insert specified text into a string– REPLACE() – substitute text “a” for text “b”– SUBSTRING() – part of a text field from a defined location– LEFT(), RIGHT() – display a certain number of charcters starting
from the Left or Right– UPPER(), LOWER(), PROPER() – Change case to UPPER, lower or
Proper case• https://msdn.microsoft.com/enca/library/ms181984(v=sql.110).aspx
SQL String Functions Available
• Conversion functions should also work– CONVERT()– CAST()
• https://msdn.microsoft.com/enca/library/ms191530(v=sql.110).aspx
• CONVERT and CAST functions work for:– Dates– Times– Money– Integers / numbers– Etc.
Conversion functions available
• When generating HTML, use the char() value for the special characters < and >– While it's possible to use the < and > characters in the SQL
expression it will make it nearly impossible to edit/modify the field if needed and will often throw errors when publishing content.
• Example: Bold formatting– <b>This is bold</b>
• Becomes:– char(60) + 'b' + char(62) + 'This is bold' + char(60) + '/b' + char(62)– The "+" symbol concatenates the parts of the text into a single field
for display
Working with HTML
• Once added, you cannot edit a custom SQL expression– You have to delete it and then add it again– If possible, test the SQL expression in SSMS (SQL Studio)
• Keep a copy of your code somewhere other than iMIS/IQA• Use the SQL summary detail from the Query• Grab field names from the summary screen to help build
the expression
Working with IQAs and Custom SQL
• Toolkit: – SQL Management Studio – Notepad++– RiSE
• Steps:1. Formulate a working IQA2. Copy the fields you need from the Summary tab to Notepad++3. Build your SQL in SQL Studio to perfect your statements4. Add one field at a time5. Test, Save, Repeat
Workflow
Formulate IQA
Copy to Notepad++
Build out SQL to perfect
Add one field at a
time
Test and Save
Workflow Demo
SQL Examples
SQL Examples
SQL Examples
• All SQL examples included in handout SQL_Examples
SQL Examples
• IQA Documentation– Query Menu and Summary Display:– http://help.imis.com/imis2017/Features/RiSE/Dynamic_Content_It
ems/Utility_gallery.htm– General IQA Information:
http://help.imis.com/imis2017/Features/RiSE/IQA__Intelligent_Query_Architect_/IQA__Intelligent_Query_Architect_.htm
• Past NiUG Conferences– IQA sessions are popular!
• ASI Video Library
Find out More
Questions!
• Thanks to Nick Srdarev, Jake Bound, ASI Consulting and Deirdre Brooks
Strategic Partners
Corporate PartnersAmericaneagle.com • Ascension Technology Solutions, LLC • Association Technologies, Inc. • Bursting Silver CadmiumCD • enSYNC Corporation • Informz • ISG Solutions • MemberPrime • RSM US LLP • Visual Antidote
Event PartnersArmstrong Enterprise Communications • Computer System Innovations • C Systems Global • iFINITY
Intuitive Business Concepts • Lane Services, LLC • Source of Knowledge (Official Recording Partner) • TGD Communications
Thank You To Our Sponsors