100% found this document useful (1 vote)
2K views1,311 pages

EpicorICETools UserGuide 102700

Uploaded by

Meri Estebal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views1,311 pages

EpicorICETools UserGuide 102700

Uploaded by

Meri Estebal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1311

Epicor ICE 3.

2 Tools User Guide


10.2.700
Disclaimer
This document and its contents, including the viewpoints, dates and functional content expressed herein are the
proprietary copyrighted property of Epicor Software Corporation, are intended for informational purposes only and
are believed to be accurate as of its date of publication. However, Epicor Software Corporation makes no guarantee,
representations or warranties with regard to the enclosed information and specifically disclaims any applicable implied
warranties, such as fitness for a particular purpose, merchantability, satisfactory quality or reasonable skill and care.
As each user of Epicor software is likely to be unique in their requirements in the use of such software and their business
processes, users of this document are always advised to discuss the content of this document with their Epicor support
representative, account manager and/or consulting personnel. All information contained herein is subject to change
without notice and changes to this document since printing and other important information about the software
product are made or published in release notes, and you are urged to obtain the current release notes for the software
product. The usage of any Epicor software shall be pursuant to an Epicor end user license agreement and the performance
of any consulting services by Epicor personnel shall be pursuant to Epicor's services terms and conditions. Usage of the
solution(s) described in this document with other Epicor software or third party products may require the purchase of
licenses for such other products. Where any software is expressed to be compliant with applicable laws or other statutory
or regulatory requirements in this document, such compliance is not a warranty and is based solely on Epicor's current
understanding of such laws and requirements. All laws and requirements are subject to varying interpretations as well
as to change and accordingly, Epicor cannot guarantee that the software will be compliant and up to date with such
changes. All statements of platform and product compatibility in this document shall be considered individually in
relation to the products referred to in the relevant statement, i.e., where any Epicor software is stated to be compatible
with one product and also stated to be compatible with another product, it should not be interpreted that such Epicor
software is compatible with both of the products running at the same time on the same platform or environment.
Additionally platform or product compatibility may require the application of Epicor or third-party updates, patches
and/or service packs and Epicor has no responsibility for compatibility issues which may be caused by updates, patches
and/or service packs released by third parties after the date of publication of this document. Epicor, Business Inspired
and the Epicor logo are trademarks of Epicor Software Corporation, registered in the United States, certain other
countries and/or the EU. All other trademarks mentioned are the property of their respective owners. Copyright ©
Epicor Software Corporation 2020. All rights reserved. Not for distribution or republication. Information in this document
is subject to Epicor license agreement(s).

10.2.700
Revision: January 28, 2021 11:36 a.m.
Total pages: 1311
sys.ditaval
Epicor ICE 3.2 Tools User Guide Contents

Contents
Introduction..........................................................................................................................19

Chapter 1: Business Activity Queries.............................................................20


Database Viewing Tools.................................................................................................................................20
Data Dictionary Viewer...........................................................................................................................21
Table View......................................................................................................................................21
Field View........................................................................................................................................22
Field Help...............................................................................................................................................24
System Queries..............................................................................................................................................27
View System Queries..............................................................................................................................27
Custom Queries.............................................................................................................................................30
New Business Activity Query...................................................................................................................30
The General Sheet...........................................................................................................................30
Define Business Activity Query Attributes..................................................................................30
The Query Builder............................................................................................................................33
Add Table................................................................................................................................33
Additional Controls..................................................................................................................35
Table Relations.........................................................................................................................36
Table List..................................................................................................................................44
Table Criteria............................................................................................................................46
SubQuery Criteria.....................................................................................................................51
Function Call Parameters..........................................................................................................69
Pivot SubQuery FOR Clause......................................................................................................72
Display Fields............................................................................................................................82
SubQuery Options..................................................................................................................121
SubQuery List.........................................................................................................................131
Updatable Business Activity Query.................................................................................................132
User Rights.............................................................................................................................133
General Properties..................................................................................................................135
Update Processing..................................................................................................................143
Analyze.........................................................................................................................................161
Analyze and Test the Query....................................................................................................162
Test the Updatable Query.......................................................................................................165
Where Used..................................................................................................................................171
BAQ Search...................................................................................................................................173
Comments....................................................................................................................................174
Actions..........................................................................................................................................175
Copy Query............................................................................................................................175
Export BAQ............................................................................................................................177
Import BAQ............................................................................................................................179

10.2.700 3
Contents Epicor ICE 3.2 Tools User Guide

Change Author......................................................................................................................183
Run BPM Designer..................................................................................................................184
Define Custom Action............................................................................................................186
Define Parameters..................................................................................................................187
Execution Settings..................................................................................................................188
Get Query Execution Plan.......................................................................................................193
Change Security Code............................................................................................................195
Reset Field Attributes Cache...................................................................................................196
Export Query Data.......................................................................................................................................197
BAQ Application Server Settings...................................................................................................................199
BAQ Info Zones............................................................................................................................................202
Activate a BAQ Zone.............................................................................................................................202
BAQ Field Security........................................................................................................................................203
BAQ Best Practices.......................................................................................................................................203
Case Studies................................................................................................................................................204
Labor Summary BAQ............................................................................................................................204
Define the Query...........................................................................................................................205
Select and Create Columns for Display...........................................................................................208
Not Clocked Out BAQ...........................................................................................................................212
Define the Query...........................................................................................................................213
Select Columns for Display............................................................................................................215
Simple Updatable BAQ.........................................................................................................................218
Define the Query...........................................................................................................................218
Define Basic Processing Details......................................................................................................220
Update and Create Supplier Records..............................................................................................222
Advanced Updatable BAQ....................................................................................................................228
Create New BAQ...........................................................................................................................228
Select Display Columns..................................................................................................................231
Select Updatable Fields..................................................................................................................233
Specify Update Processing Method................................................................................................235
Analyze Tracing Log......................................................................................................................236
Use Updatable Field Editor.............................................................................................................246
Tour Updatable BAQ Method Directives.........................................................................................249
Create New Directive.....................................................................................................................252
Test Events....................................................................................................................................256
Configure Customer ID Condition.................................................................................................259
Configure BO Call.........................................................................................................................261
Fill TableSet Variable......................................................................................................................265
Add Remaining Customer Change Methods..................................................................................270
Update ttResults Table...................................................................................................................275
Build ShipTo Change Workflow Branch.........................................................................................283
Build Ship By Date Assignment Workflow Branch...........................................................................287
Complete the Directive..................................................................................................................291
Test BAQ Results...........................................................................................................................293
Using Inner SubQueries.........................................................................................................................299

4 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Create Open Orders SubQuery......................................................................................................299


Select Columns..............................................................................................................................301
Create Closed Orders SubQuery....................................................................................................303
Select Columns..............................................................................................................................305
Create TopLevel SubQuery.............................................................................................................305
Select BAQ Display Columns..........................................................................................................307
Test the BAQ.................................................................................................................................309
Combine Results Sets Using Union........................................................................................................310
Create TopLevel BAQ.....................................................................................................................311
Create Order View SubQuery.........................................................................................................315
Create Invoice View SubQuery.......................................................................................................321
Create Query Parameter................................................................................................................323
Test the BAQ.................................................................................................................................325
Advanced Data Aggregation.................................................................................................................328
Create Order View SubQuery.........................................................................................................328
Create Quote View SubQuery........................................................................................................335
Create TopLevel Subquery.............................................................................................................339
Test the BAQ.................................................................................................................................345
Intersect and Except SubQuery Type.....................................................................................................348
Create TopLevel BAQ.....................................................................................................................348
Create Intersect SubQuery.............................................................................................................351
Use Except SubQuery Type............................................................................................................356
Common Table Expression Query..........................................................................................................358
Create CTE SubQuery....................................................................................................................358
Create Query Parameter................................................................................................................360
Select Columns..............................................................................................................................362
Define UnionAll SubQuery.............................................................................................................365
Select Columns..............................................................................................................................367
Create TopLevel SubQuery.............................................................................................................369
Test the BAQ.................................................................................................................................371
BAQ Combo.........................................................................................................................................374
Define the Query...........................................................................................................................374
Customize the Form......................................................................................................................378
Add the BAQ Markup....................................................................................................................382
Test the Results.............................................................................................................................385
Transforming Legacy First/Last Table Modifiers......................................................................................386
Example 1.....................................................................................................................................387
Example 2.....................................................................................................................................393

Chapter 2: External Business Activity Queries............................................402


External Datasource Type Maintenance........................................................................................................402
Create New Datasource Type................................................................................................................403
Create New Filter Group.......................................................................................................................404
Add New Definition..............................................................................................................................404

10.2.700 5
Contents Epicor ICE 3.2 Tools User Guide

Apply Table Filter..................................................................................................................................406


Apply Column Filter..............................................................................................................................407
External Datasource Maintenance................................................................................................................408
Create an External Datasource..............................................................................................................409
Use the Distribution sheet.....................................................................................................................413
Export Datasources...............................................................................................................................415
Import Datasources...............................................................................................................................417
32 Bit vs 64 Bit ODBC...........................................................................................................................418
External Datasource Metadata Maintenance.................................................................................................420
Retrieve External Tables........................................................................................................................421
Use Table List........................................................................................................................................424
Modify Field Properties.........................................................................................................................425
Enable External Datasources.........................................................................................................................426
Design External Business Activity Query........................................................................................................428
Update External Datasource.........................................................................................................................431

Chapter 3: BAQ Report Designer..................................................................433


BAQ and BAQ Report Datasets.....................................................................................................................433
Standard BAQ Report Interface....................................................................................................................434
BAQ Report Options....................................................................................................................................437
Create a BAQ Report...................................................................................................................................438
Add the BAQ Report.............................................................................................................................438
Add Option Fields.................................................................................................................................442
Test the Report.....................................................................................................................................444
Design the Report Layout......................................................................................................................446
Implement the Report...........................................................................................................................455
Customize a BAQ Report.............................................................................................................................458

Chapter 4: Searches.......................................................................................466
Default Search Interface...............................................................................................................................466
Default Features...................................................................................................................................466
Hot Key Searches..................................................................................................................................469
Quick Searches............................................................................................................................................471
Create a Quick Search..........................................................................................................................472
Activate Quick Search....................................................................................................................472
Quick Search Detail Sheet..............................................................................................................473
Quick Search Criteria.....................................................................................................................476
Test a Quick Search.......................................................................................................................481
Display a Quick Search..........................................................................................................................482
Quick Search Tab...........................................................................................................................482
Context Menu Options..................................................................................................................484
Default Search Program.................................................................................................................485
Business Activity Query Searches..................................................................................................................488
Enable BAQ Search Fields......................................................................................................................488

6 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Use a BAQ Search.................................................................................................................................491


Advanced Searches......................................................................................................................................493
Use an Advanced Search.......................................................................................................................494
Named Searches..........................................................................................................................................494
Create a Named Search........................................................................................................................494
Named Search Details...........................................................................................................................498
Auto Populate Data..............................................................................................................................500
Auto Load Search.................................................................................................................................502
Override Search Options..............................................................................................................................505
Data Tag Searches.......................................................................................................................................505
Add Data Tags to a Record...................................................................................................................505
Add Data Tags to Records in a Grid......................................................................................................507
Perform a Data Tag Search...................................................................................................................509
Data Tags and BPM Directives...............................................................................................................511
Data Tag Maintenance..........................................................................................................................512
Predictive Search..........................................................................................................................................515
Activate Predictive Search.....................................................................................................................515
Define Source BAQ...............................................................................................................................517
Create Predictive Search.......................................................................................................................521
Test Predictive Search...........................................................................................................................523
Enterprise Search.........................................................................................................................................524
Activate Enterprise Search.....................................................................................................................525
Smart Client Enterprise Search..............................................................................................................526
Web Client Enterprise Search................................................................................................................529
Enterprise Search Filter Options.............................................................................................................531

Chapter 5: Business Process Management..................................................533


BPM Base Elements......................................................................................................................................533
Assign BPM Advanced User Rights...............................................................................................................534
Expression Security - BPM Rights...........................................................................................................535
Directive Scope............................................................................................................................................536
Holds...........................................................................................................................................................537
Hold Type Maintenance........................................................................................................................538
Hold Type Maintenance – How to Use...........................................................................................538
BPM Holds............................................................................................................................................540
BPM Holds – How to Use...............................................................................................................540
Review BPM Holds.........................................................................................................................542
Directives.....................................................................................................................................................543
Method Directives.................................................................................................................................543
Data Directives......................................................................................................................................544
Updatable BAQ Method Directives........................................................................................................545
How it Works................................................................................................................................545
Custom Actions.............................................................................................................................548
How BPM Works..................................................................................................................................548

10.2.700 7
Contents Epicor ICE 3.2 Tools User Guide

Standard Execution Flow...............................................................................................................549


Using Business Process Management.............................................................................................549
Create a New Directive.........................................................................................................................551
Locate Service Method..................................................................................................................551
Create the Directive.......................................................................................................................554
BPM Workflow Designer.......................................................................................................................556
General Principles..........................................................................................................................557
BPM Query....................................................................................................................................560
Validate Directive...........................................................................................................................562
Customize Element Block..............................................................................................................565
Availability of Workflow Elements..................................................................................................569
Copy and Paste Workflow Elements..............................................................................................570
Transmission Rules.................................................................................................................572
Directive Level Variables.................................................................................................................573
Create New Variables.............................................................................................................573
Variables vs. Parameters.........................................................................................................577
Availability of Directive Variables.............................................................................................577
Validation...............................................................................................................................584
Reference Variables Using Context Menu...............................................................................585
Callers...........................................................................................................................................585
Call BPM Data Form...............................................................................................................585
Call SC Workflow...................................................................................................................586
Execute Custom Code............................................................................................................589
Invoke External Method..........................................................................................................590
Invoke BO Method.................................................................................................................592
Invoke Function......................................................................................................................594
Flow Chart....................................................................................................................................596
Condition...............................................................................................................................596
List of Conditions...................................................................................................................597
Labels............................................................................................................................................606
Attach Data Tag.....................................................................................................................606
Remove Data Tag...................................................................................................................607
Attach Hold............................................................................................................................608
Remove Holds........................................................................................................................609
Other............................................................................................................................................609
Auto Print..............................................................................................................................610
Change Log...........................................................................................................................611
Enable Post Directive..............................................................................................................612
Enable Standard Directive.......................................................................................................612
Notify Collaborate..................................................................................................................613
Raise Exception......................................................................................................................616
Send E-mail............................................................................................................................617
Show Message.......................................................................................................................619
Setters...........................................................................................................................................621
Set BPM Data Field.................................................................................................................621

8 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Set By Query..........................................................................................................................622
Set Field.................................................................................................................................623
Set Argument/Variable...........................................................................................................624
Fill Table By Query..................................................................................................................625
Update Table By Query...........................................................................................................627
Processing Asynchronous Actions.........................................................................................................629
Support for Multiple Dirty Rows............................................................................................................630
Dependent Directives...................................................................................................................................631
Primary Directive...................................................................................................................................631
Dependent Directive.............................................................................................................................631
Epicor Functions...........................................................................................................................................631
Functions Roles.....................................................................................................................................632
Assigning Users to Functions Security Groups................................................................................633
Summary of Security Rights by Role...............................................................................................633
Types of Functions................................................................................................................................634
Creating Function.................................................................................................................................635
Add a Library.................................................................................................................................635
Add References......................................................................................................................637
Set Up Security.......................................................................................................................641
Add a Widget Function..................................................................................................................642
Set Up Main Properties...........................................................................................................642
Define Parameters..................................................................................................................643
Design Function.....................................................................................................................645
Add a Custom Code Function........................................................................................................676
Function Editor.......................................................................................................................677
Copying Function.................................................................................................................................687
Exporting Library...................................................................................................................................688
Importing Library..................................................................................................................................689
Publishing/Unpublishing Library............................................................................................................694
Calling Function from BPM Directive.....................................................................................................696
Add a New Function......................................................................................................................697
Design Function Workflow.....................................................................................................697
Create an Order (Optional)............................................................................................................705
Add BPM Directive 1......................................................................................................................706
Add BPM Directive 2......................................................................................................................707
Test Function Calls.........................................................................................................................709
Calling Function via REST......................................................................................................................710
Calling Function from Client Customization..........................................................................................713
Create the REST Client...................................................................................................................713
Specify Call Context......................................................................................................................715
Execute Call...................................................................................................................................717
Handle Response...........................................................................................................................719
Scheduling Functions............................................................................................................................720
Schedule a Function......................................................................................................................720
Installing Libraries.................................................................................................................................721

10.2.700 9
Contents Epicor ICE 3.2 Tools User Guide

Add Library to Solution..................................................................................................................721


Debugging Function Source Code.........................................................................................................723
Case Studies................................................................................................................................................725
Make a Field Mandatory.......................................................................................................................725
Select Business Object Method......................................................................................................725
Add a Pre-Processing Directive.......................................................................................................727
Add First Condition.......................................................................................................................728
Extend First Condition...................................................................................................................730
Add First Action.............................................................................................................................733
Add Another Condition.................................................................................................................735
Check for Sales Kit Part.................................................................................................................737
Extend Second Condition..............................................................................................................738
Add Second Action........................................................................................................................741
Test the BPM for the Part Class......................................................................................................744
Test the BPM for the Part Group....................................................................................................745
Create and Use a Hold Type..................................................................................................................746
Create the Hold Type.....................................................................................................................746
Select Business Object Method......................................................................................................748
Add a Pre-Processing Directive.......................................................................................................750
Add an Action...............................................................................................................................753
Add a Pre-Processing Directive.......................................................................................................754
Add an Action...............................................................................................................................757
Add a Post-Processing Directive.....................................................................................................758
Add an Action...............................................................................................................................760
Add a Post-Processing Directive.....................................................................................................762
Add an Action...............................................................................................................................764
Add a Method Code......................................................................................................................765
Add a Post-Processing Directive.....................................................................................................768
Add an Action...............................................................................................................................770
Test the BPM.................................................................................................................................772
Use Auto Print Action...........................................................................................................................776
Locate the OrderHed Table............................................................................................................776
Add Standard Directive..................................................................................................................777
Add an Action...............................................................................................................................779
Define Report Parameters..............................................................................................................782
Test the BPM.................................................................................................................................784
Use Fill Table By Query and Invoke BO Method.....................................................................................786
Select Business Object Method......................................................................................................786
Create New Directive.....................................................................................................................787
Configure Condition......................................................................................................................789
Specify BO Method........................................................................................................................790
Configure Method Parameters.......................................................................................................791
Design BPM Query.........................................................................................................................795
Select Target Table........................................................................................................................800
Configure Table Mappings............................................................................................................800

10 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Activate the Directive.....................................................................................................................805


Test the Directive...........................................................................................................................806
Update Table Using BPM Query............................................................................................................807
Select Business Object Method......................................................................................................808
Create New Directive.....................................................................................................................809
Configure Condition......................................................................................................................811
Design BPM Query.........................................................................................................................813
Select Target Table........................................................................................................................815
Configure Table Mapping..............................................................................................................817
Test the Directive...........................................................................................................................820
Set Up Security for Posting Invoices.......................................................................................................821
Create Security Group...................................................................................................................821
Select Process Method...................................................................................................................822
Add Pre-Processing Directive..........................................................................................................823
Test Directive.................................................................................................................................827
Set Default Value for Report Parameter.................................................................................................830
Select Report Method....................................................................................................................831
Add Post-Processing Directive........................................................................................................832
Test Directive.................................................................................................................................835

Chapter 6: Custom Business Process Management.....................................837


Execute Custom Code Directive...................................................................................................................837
Create the Data Directive......................................................................................................................837
Test the Data Directive..........................................................................................................................841
BPM Data Form Designer.............................................................................................................................845
Create a BPM Data Form......................................................................................................................845
Add Fields.....................................................................................................................................846
Define Control Values....................................................................................................................848
Create Password............................................................................................................................849
Create or Remove Buttons.............................................................................................................850
Test the Form................................................................................................................................851
Data Form Directive..............................................................................................................................852
Create BPM Data Form Action.......................................................................................................852
Create Send E-Mail Action.............................................................................................................855
Design E-mail Template.................................................................................................................855
Test the BPM Form........................................................................................................................859
External Methods and Workflows................................................................................................................862
Assign BPM Advanced User Rights........................................................................................................863
Method Arguments..............................................................................................................................864
Programming Interface Generator Form................................................................................................865
.NET Assembly [C#].......................................................................................................................865
.NET Assembly [VB.NET].................................................................................................................867
Service Connect Workflow............................................................................................................869
External Method Logic..........................................................................................................................871

10.2.700 11
Contents Epicor ICE 3.2 Tools User Guide

Programming Action Signatures....................................................................................................872


.NET Process [C#]...........................................................................................................................873
.NET Process [VB.NET]....................................................................................................................874
Deploy the External Method.................................................................................................................875
Attach the External Method..................................................................................................................875
Build the Method..........................................................................................................................875
Test the Method............................................................................................................................879

Chapter 7: Business Process Management Utilities....................................882


Directive Management.................................................................................................................................882
Groups.................................................................................................................................................882
Directive Export....................................................................................................................................883
Directive Import....................................................................................................................................885
Import User Rights.........................................................................................................................886
Import Compatibility......................................................................................................................887
Directive Update...................................................................................................................................887
Update a Directive Group..............................................................................................................887
Recompile a Directive Group..........................................................................................................889
Remove a Directive Group.............................................................................................................892
Update ESC Credentials.................................................................................................................895
Troubleshooting Actions..............................................................................................................................898
BPM Tracing.........................................................................................................................................898
Client Trace Log............................................................................................................................898
Activate From User Account...................................................................................................898
Activate From Client...............................................................................................................901
Select Tracing Options............................................................................................................904
Server Trace Log............................................................................................................................906
Debugging Using Visual Studio.............................................................................................................909
Prerequisites..................................................................................................................................909
Debug BPM Directive.....................................................................................................................910
Debug Custom Project...................................................................................................................913
Disable BPM.........................................................................................................................................915

Chapter 8: Global Alerts................................................................................916


Global Alerts Setup......................................................................................................................................916
Company Maintenance - Email Settings................................................................................................916
Alert Attachments - Shortcut Link.........................................................................................................918
Alert Data Directive for Standard Global Alerts......................................................................................919
Create Data Directive.....................................................................................................................919
Define the Condition.....................................................................................................................921
Define the Send E-Mail Action.......................................................................................................923
Connect the Directive Sequence and Enable the Directive..............................................................927
Standard Global Alerts.................................................................................................................................929
Standard Global Alert for Specific Recipient..........................................................................................929

12 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Activate the Global Alert...............................................................................................................930


Set Up the Work Force..................................................................................................................931
Set Up a Test Sales Order...............................................................................................................932
Trigger the Alert............................................................................................................................933
Alert for Alert Group............................................................................................................................935
Alert Groups..................................................................................................................................936
Activate the Global Alert...............................................................................................................936
Set Up an Alert Group...................................................................................................................937
Set Up a Person.............................................................................................................................938
Assign the Person to a Production Team........................................................................................939
Trigger the Alert............................................................................................................................940
Custom Global Alerts...................................................................................................................................941
Refine the Shortcut Link File..................................................................................................................941
Create the Data Directive......................................................................................................................943
Define the Alert Condition....................................................................................................................945
Define the Send E-mail Alert Action......................................................................................................948
Connect the Directive Sequence and Enable the Directive.....................................................................952
Test the Custom Alert...........................................................................................................................954
Test the Shortcut Link...........................................................................................................................956

Chapter 9: Dashboards..................................................................................959
Standard System Dashboards.......................................................................................................................959
Navigate in a Dashboard.......................................................................................................................960
Conduct an Advanced Search...............................................................................................................964
Assign Dashboard Developer Rights.............................................................................................................965
Dashboard Creation.....................................................................................................................................966
Dashboard Developer Mode.................................................................................................................966
Add a Query to the Dashboard.............................................................................................................970
Add the Query...............................................................................................................................970
Modify Query Properties.......................................................................................................................975
General Properties.........................................................................................................................975
Publish to Title Bar.........................................................................................................................977
Apply Filters to a Query.................................................................................................................979
The Grid View.......................................................................................................................................981
The Grid Properties Window..........................................................................................................982
Change Display Columns and Enable Group By and Summarization in a Grid.........................982
Change the Grid Display.........................................................................................................985
Apply a Filter to a Grid...........................................................................................................990
Add a New Grid View to the Dashboard.................................................................................991
Add a Rule to Highlight Cells..................................................................................................995
Add an Image Column to a Grid Based on a Rule...................................................................999
The Chart View...................................................................................................................................1004
The Chart Properties Window......................................................................................................1004
Add a Chart View.................................................................................................................1004

10.2.700 13
Contents Epicor ICE 3.2 Tools User Guide

Chart Settings.............................................................................................................................1007
Modify Chart Settings..........................................................................................................1007
The Tracker View................................................................................................................................1010
The Tracker Properties Window...................................................................................................1011
Add a Tracker View for an Advanced Search.........................................................................1011
Add an Advanced Search with Range...................................................................................1013
The Gauge View.................................................................................................................................1020
The Gauge Properties Window....................................................................................................1020
Add a Gauge View to the Dashboard...................................................................................1020
The URL/XSLT View.............................................................................................................................1023
URL/XSLT Properties.....................................................................................................................1023
Add a URL Link to Display the Customer Website.................................................................1023
The Process Link.................................................................................................................................1026
Process Link Properties.................................................................................................................1026
Add a Process Link for Customer Entry.................................................................................1026
The Report View and Report Link........................................................................................................1030
Report Options............................................................................................................................1030
Design Crystal Report..................................................................................................................1031
Select Report Data.......................................................................................................................1035
Add Report View.........................................................................................................................1042
Add a Report Link to the Dashboard............................................................................................1045
Publish and Subscribe Functionality............................................................................................................1049
Add a Secondary Query to Display Line Item Shipment Information.....................................................1049
Publish................................................................................................................................................1051
Publish Fields from a Query..........................................................................................................1052
Subscribe............................................................................................................................................1053
Apply a Filter that Subscribes to the Published Order and Line Number........................................1053
Bind Query Parameter to a Published Column.....................................................................................1056
The Dashboard Browse..............................................................................................................................1061
Add a Dashboard Browse to the Dashboard........................................................................................1061
Dashboard User Notes and Tech Notes.......................................................................................................1068
Update Notes.....................................................................................................................................1069
Dashboard Properties.................................................................................................................................1070
Modify the Dashboard Title Bar...........................................................................................................1071
Enable the Dashboard as Advanced Search.........................................................................................1073
Dashboard Modification.............................................................................................................................1075
Copy a Dashboard..............................................................................................................................1075
Multi Threaded Save..................................................................................................................................1078
Reusing Views............................................................................................................................................1081

Chapter 10: Dashboard Utilities.................................................................1089


Export and Import Dashboards...................................................................................................................1089
Export Definition.................................................................................................................................1089
Import Definition................................................................................................................................1091

14 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Deploy Dashboards....................................................................................................................................1095
Deploy Dashboard as an Application...................................................................................................1095
Access New Dashboard.......................................................................................................................1100
Deploy Kinetic Dashboards.........................................................................................................................1105
Deploy Dashboard as a Kinetic Application.........................................................................................1105
Add Kinetic Dashboard to the Main Menu..........................................................................................1108
Mobile Device Dashboards.........................................................................................................................1111
Assign Mobile Access Rights...............................................................................................................1111
Create a Mobile Device Dashboard.....................................................................................................1112
Define Mobile Navigation...................................................................................................................1115
Deploy Mobile Dashboard Device........................................................................................................1120
Mobile Menu Maintenance.................................................................................................................1123
Explore Home Page.............................................................................................................................1124
Launch Mobile Dashboard..................................................................................................................1126
Filter Data...........................................................................................................................................1127
Update Records Using Mobile Dashboard...........................................................................................1131
URL Query Phrase Subscribers....................................................................................................................1134
Create New Dashboard.......................................................................................................................1135
Create URL View.................................................................................................................................1137
Epicor SharePoint Publisher........................................................................................................................1140
Create a New Web Part Page..............................................................................................................1141
Modify a Web Page............................................................................................................................1143
Arrange Views Within the SharePoint Page.........................................................................................1147
Adjust the ESP Dashboard...................................................................................................................1149
Web Dasher........................................................................................................................................1152

Chapter 11: Updatable Dashboards...........................................................1155


Assign Updatable BAQ Rights....................................................................................................................1155
Updatable Business Activity Queries...........................................................................................................1157
Define an Updatable BAQ...................................................................................................................1157
Set Up the Updatable Query...............................................................................................................1158
General Properties..............................................................................................................................1160
Primary Updatable Properties.......................................................................................................1160
Define Updatable Fields...............................................................................................................1161
Updatable Field Editor.................................................................................................................1164
Update Processing..............................................................................................................................1166
Advanced BPM Processing...........................................................................................................1167
Update Processing.......................................................................................................................1168
Analyze..............................................................................................................................................1173
Update Existing Record................................................................................................................1173
Add New Record.........................................................................................................................1177
Customer Contact Updatable BAQ.....................................................................................................1180
Define the Query.........................................................................................................................1180
Add the Tables............................................................................................................................1181

10.2.700 15
Contents Epicor ICE 3.2 Tools User Guide

Link the Role Code Table.............................................................................................................1184


Add the Ship To Table.................................................................................................................1186
Select Columns for Display..........................................................................................................1190
Indicate the Sort Order................................................................................................................1194
Define the Updatable Fields.........................................................................................................1195
Activate Database Processing.......................................................................................................1196
Test the Updatable BAQ..............................................................................................................1198
Regenerate Updatable BAQs...............................................................................................................1205
Updatable Dashboards...............................................................................................................................1207
Create a Dashboard............................................................................................................................1208
Add Customer Query..........................................................................................................................1209
Modify Customer Grid Properties........................................................................................................1212
Add Updatable Contact Query............................................................................................................1215
Modify Contact Grid Properties...........................................................................................................1220
Add Tracker View for Contact Query..................................................................................................1223
Test Updatable Dashboard..................................................................................................................1225
Updatable BAQ Method Directives.............................................................................................................1230
Custom Actions..................................................................................................................................1230
Default Data to Updatable BAQ Records.............................................................................................1231
Publish Dashboard Data...............................................................................................................1231
Get the Updatable BAQ Methods................................................................................................1233
New Post-Processing Directive.....................................................................................................1234
Select BAQ Directive Action.........................................................................................................1235
Define BAQ Directive Action........................................................................................................1236
Add More Set Field Actions.........................................................................................................1239
Test the Directive.........................................................................................................................1240

Chapter 12: Executive Dashboards.............................................................1244


ShopVision Module....................................................................................................................................1244
How Executive Dashboards Work...............................................................................................................1245
Executive Dashboard Setup........................................................................................................................1246
Schedules...........................................................................................................................................1246
Process Set Maintenance....................................................................................................................1247
The Business Activity Query (BAQ).......................................................................................................1248
Executive Dashboard Creation....................................................................................................................1249
Create an Executive Dashboard - Overview.........................................................................................1249
Executive Query..................................................................................................................................1249
What It Adds...............................................................................................................................1250
Limitations...................................................................................................................................1250
Create the Base Cube Query........................................................................................................1250
Field Mapping.............................................................................................................................1253
Save to Process Set......................................................................................................................1255
Executive Query Examples...................................................................................................................1257
Example One...............................................................................................................................1257

16 10.2.700
Epicor ICE 3.2 Tools User Guide Contents

Example Two...............................................................................................................................1258
Create a Dimension BAQ....................................................................................................................1259
Build the Executive Query Against Data Dimensions.....................................................................1265
Schedule a Process Set........................................................................................................................1267
Create BAQs for Executive Dashboard Display.....................................................................................1268
Dimension BAQ...........................................................................................................................1268
Dimension Details BAQ................................................................................................................1269
Data BAQ....................................................................................................................................1270
Create and Deploy a Dashboard.........................................................................................................1271
Verify the Process Set..........................................................................................................................1272

Chapter 13: Epicor Data Analytics..............................................................1273


Design Database........................................................................................................................................1273
Add User-Defined Fields......................................................................................................................1273
Add Base Currency Measures..............................................................................................................1282
Create Financial Statements Database.................................................................................................1289
Export Chart of Accounts to Excel................................................................................................1290
Map Accounts.............................................................................................................................1295
Design Financial Statements Database.........................................................................................1298
Troubleshooting.................................................................................................................................1303
Inventory Databases Do Not Display Historic Data........................................................................1303

10.2.700 17
Contents Epicor ICE 3.2 Tools User Guide

18 10.2.700
Epicor ICE 3.2 Tools User Guide Introduction |

Introduction

The Epicor Tools User Guide explores the data gathering and monitoring tools available within the Epicor ICE
framework. This guide is intended for managers responsible for fine-tuning their departmental use of the Epicor
ERP application and advanced users looking to manage and display key data for their specific business needs.
The first chapters examine business activity queries, or BAQs, which are the primary query tools you use for
pulling, displaying, and entering specific data. You can create BAQs that display unique views of data, and also
updatable BAQs that contain fields you activate for data entry. Next you explore how to use the External Query
functionality to manipulate data from external data sources. Then the BAQ Report Designer chapter explains how
to turn a BAQ into a SQL Server Reporting Services (SSRS) report.
The Searches chapter that follows explores the tools you can use to easily locate and organize records using filters
and specific criteria.
The chapters that follow discuss the Business Process Management (BPM) functionality you can use to create
workflows that automate, execute and monitor business processes. Learn how to create method, data, and BAQ
directives that ensure data entries are valid and reflect your business cycle. The Custom Business Process
Management chapter discusses more advanced techniques such as execution of custom code written in C#
language or creation of external methods. The BPM functionality is concluded with an overview of utilities available
within the BPM module.
Then, the Global Alerts chapter explores how you can use both standard and custom global alert messaging.
Global alerts are email messages you activate to help specific users track data activity. Learn how to determine
which alerts you want continuously monitoring data and who will receive the automatic email messages generated
by the specific database activity.
The chapters that follow explore how to monitor, display and manipulate your business data using Dashboards.
Learn how to incorporate BAQs and BPMs for custom use on smart client dashboards, executive dashboards,
and mobile device dashboards.
The guide concludes with the Epicor Data Analytics (EDA) chapter. You can use this business analytics tool for
long-term data exploration in a data warehouse.
Use this guide as a starting point to learn about the available data flow tools and as a reference for later use of
these same tools. This guide is a crucial resource for anyone who monitors data to both manage and enhance
their organization’s unique business practices.

10.2.700 19
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Chapter 1: Business Activity Queries

Use the Business Activity Query (BAQ) Designer to create personalized queries or to copy system queries so you can
modify them. Queries can be accessed in different ways throughout the Epicor ERP application. Queries can be used
to generate Reports, included in application Searches, displayed and updated through a dashboard and mobile devices.
BAQ execution results can also be exported as .xml or ASCII files, so you can edit their data in third party applications
as well. The functionality has some security options, as you can create queries only available for your personal use, or
create shared queries available to everyone within your company.

Example You are in charge of your company’s security. You need


to build one query that lists all security IDs in the system for the
current company. Since this item is a sensitive query, you do not
select it as a shared query.
You next create a query that summarizes the status of current orders.
Because you want everyone to be aware about the progress of the
sales orders, you define this query as a shared query.

Leveraging this functionality does require some fundamental knowledge of database concepts such as table relationships,
records, and field types. This knowledge helps you create queries that have good performance and display the results
you want. You start by defining the information to display through your BAQ, and then finding out which database
tables contain the appropriate columns which hold this data. Some application tools are available which can help you
find the database information you need. This chapter describes these tools.
Once you determine the information you want to display, you can begin creating the query through the Business
Activity Query Designer. Use the Query Builder sheets to define which tables you want to include in your main query,
potential subqueries and what relationship they have with each other. You also define subquery parameters and decide
which columns you want to display for the end user. Finalize your BAQ by testing it using the Analyze sheet, correct
any errors before you use this query on a dashboard or mobile device.
Queries can be read only tools which you can later place on a smart client dashboard for display on the Main Menu.
You can also create an updatable BAQ. These BAQs can be placed on a smart client dashboard and/or used on a mobile
device, such as an iPhone® or a Blackberry®. Users then enter data through either the dashboard or the mobile device,
and this new data updates records within the main database. Business Process Management (BPM) directives can be
created which monitor the data entered through an updatable BAQ. Based on the conditions defined in the BPM
directive, various actions run automatically. For example, you could use this functionality to verify data is being correctly
entered into the database. Updatable dashboards and BAQ directives are described in later chapters in this guide, but
you will learn the basic principles for updatable BAQ functionality through this chapter.
To further leverage the BAQ functionality, you can connect to an external data source using the ODBC connection.
Use this feature to design an external query in a similar way to create an ordinary query. For more information on how
to utilize External BAQs, review the External Business Activity Queries chapter.

Database Viewing Tools

The Epicor application contains tools to help you locate database information you need. These tools also reduce
issues with your BAQs, as you can leverage them to make sure you reference correct fields and tables within your
modified and personalized queries. This section describes Data Dictionary Viewer and Field Help options you can
use to find the required information before you start designing your custom query.

20 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Data Dictionary Viewer

You use the Data Dictionary Viewer to find and review details of each field and table within the database. It helps
you better understand the purpose and data values of every field.
Use this program to identify the fields and tables you want within a custom business activity query. This program
is also an aid during upgrades, as you can view the current database structure to compare it against a previous
database version; this helps to ensure your BAQs match the current state of the database.
Menu Path: System Setup > System Maintenance > Data Dictionary Viewer

Table View

To use the Data Dictionary Viewer:

1. In the Table Schema Type, select a schema that holds the table of your interest.
The available options include:
• System - Select this option to retrieve tables belonging to the ICE schema which refers to the Tools
(framework) part of the system.
• Product - Select this option to retrieve tables belonging to the ERP schema which refers to the Application
part of the system.
• Intermediate - Select this option to retrieve intermediate tables. Tables within this schema stage the
data for another process to come through and update the main database tables.

10.2.700 21
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the Table button to find and select the table you wish to review.

In Epicor ERP version 10, user-defined columns are placed


within separate UD tables.
For example, the Part table may have a corresponding
Part_UD table.

3. The Description field displays a brief explanation for the table.

4. The IndexName column displays the index name used by the database to access a specific field. Each field
is displayed using its database schema name. In this example, ABCldx is shown.

5. The Fields displays which column(s) of a database table are associated with a particular index as well as the
order in which columns are listed in the index definition.

6. The Display Format section contains options that change how the information displays on the Tree View.
Available options:
• Schema – Select this option to display the table fields in schematic order on the Tree View. This defines
the order of precedence in which the fields are evaluated by the application. For example, Company,
Resource Group, Alternate Resource Group.
• Alphabetic – Select this option to display the table fields in alphabetic order on the Tree View. For
example, Alternate Resource Group, Company, Resource Group.

Field View

You can also use the Data Dictionary Viewer to display information on a selected field.

1. In the Tree View, select a field. In this example, you select the Count Frequency field.

22 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. The Fields > Detail sheet displays the field’s information.

3. The Field Name displays the selected field. If you need, you can use the Navigation toolbar to display a
different field.

4. The Format field defines the layout for the characters within the field. This value displays in either schema
or alphanumeric format; for example, X(8), >>9.

5. If this field is a Decimal type (see the Type field description below), the Decimals field displays how many
decimal positions are available within the field.

6. The Extent field indicates how many items you can store within this field for each record. If this value is
higher than one, it indicates multiple values can appear within this field. For example, if 5 displays, the field
can contain up to five items.

7. The Type field defines the selected field’s main data definition. The type defines the data that displays within
the field; for example, nvarchar, integer, bit.

8. The Initial Value field defines the beginning value, if any, that automatically displays within this field. It
indicates the default value that appears each time a user views this field.

9. If this field is displayed on a grid, the Column Label field indicates the text that displays at the top of the
grid column; for example, Count Freq.

10. The Label field displays the title that displays above the field on a sheet, for example, Count Frequency.

10.2.700 23
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. When selected, the Mandatory check box indicates the current field is required. To finish a record within
this table, users must either enter data or select an option within this field.

12. The Description field displays the concise explanation for the field. This text explains the field’s purpose
and other useful information.

13. The Display Format section contains options that change how the selected field’s information displays on
the Fields sheet. Here is what these options do:
• Schema – When selected, this option displays the field’s schematic values. These values define how the
database views and evaluates this field’s data.
• Alphabetic – When selected, this option displays the field’s alphanumeric values. Use these values to
help you understand how the field’s data appears on the interface.

Field Help

Use the Field Help feature to display the technical details on a specific field within a program (form). With the
Field Help window displayed, you can immediately see the technical information you need on each field. When
you click the mouse pointer inside a field, the Field Help window displays the field details from the Data Dictionary.
Navigate and launch the program that contains fields you want to use in a BAQ to activate field help within each
program.
For this example, you launch Ship Via Maintenance: Sales Management > Order Management > Setup >
Ship Via.

1. Click the Help menu.

2. From the menu options, select Field Help to display the pane in the left portion of the screen.

24 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. Click the Thumbtack icon to pin the window in place. If you do not click this icon, the Field Help window
automatically minimizes to the side of the window (form). You can then display Field Help again by clicking
the button that displays on the side of the window.

4. When the Field Help window is pinned to the interface, you can view the technical details for the current
field. To do this, click the Technical Details button.

5. The Field Help window displays the technical details on each selected field. For this example, the Description
field is selected on the Detail sheet, and so the technical details for this field display within the Field Help
window.

10.2.700 25
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. The Field Name displays the selected field.

7. The EpiBinding field displays the name to use if you want to link to this field through a customization or
a code reference. This value uses the ViewName.FieldName format. ViewName is the name of the view on
the user interface; FieldName is the database column name.

8. The DB Field value contains the information you most likely need for your BAQ. It displays the table name
and the column name for the selected field. Typically, this value is identical to the EpiBinding value and it
displays the true database name for the field.

9. The Format field defines the layout for the characters within the field. This value displays in either schema
or alphanumeric format; for example, X(30).

10. If this field is a Decimal type, the Decimals field displays how many decimal positions are available within
the field.

11. The Data Type field defines the selected field’s main data definition. The type defines the data that appears
within the field; for example; Character, Decimal, Boolean (True or False).

12. If this field is displayed on a grid, the Column Label field indicates the text that appears at the top of the
grid column.

26 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. The Description field displays the concise explanation for the field. This text explains the field’s purpose
and other useful information.

14. Continue to click other fields to display the technical details for each field on the form. When you finish,
click Close on the Field Help toolbar.

System Queries

Several system queries developed by Epicor are installed within the application. The delivered queries all begin
with the letter ‘z’ so that you can easily differentiate them from queries you create. When you create a custom
query, or copy an existing query to modify it, you must follow specific naming conventions.
Navigate to Business Activity Query Designer.
Menu Path: Executive Analysis > Business Activity Management > Setup > Business Activity Query

This program is not available in Epicor Web Access.

View System Queries

To view the list of system queries:

1. Click the Query ID button.

2. Notice you can filter the business activity queries by various types. To view system queries, select the
System check box.

10.2.700 27
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. Click Search.

4. Look at system query properties.

You cannot modify a system query delivered with the


Epicor application. You must first copy the query, rename
it, and then modify it. This process is reviewed in the Copy
Query section later in this chapter.

5. The Author field displays the login of the user who created the BAQ. Only the author can modify their
BAQs. However, you can assign a new author to modify a BAQ. To do this, from the Actions menu, select
Change Author. This functionality is explored in the Actions Menu section of this chapter.

6. The Description field describes the purpose of the query.

7. The Shared property indicates whether a query is available to all users within the current company. System
queries are all marked as Shared.

8. The Cross-Company check box indicates the ability of a query to brings back all results across companies.
In order to use this function, a selected user must have the ability to create cross-company queries.

9. If a query is Updatable, a check mark displays in this column as well. This value indicates users can enter
data within the BAQ that then updates the database.

10. The External queries use data retrieved from an external datasource outside the Epicor ERP application.
They are created within the External Business Activity Designer found in the System Management module.
To learn more about this functionality, review the External Business Activity Queries chapter.

28 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

11. As you indicated in the Search criteria, only System queries display on the list.
All system queries are created by Epicor, and this column indicates Epicor delivered these BAQs to your
database.

12. The All Companies check box indicates whether the BAQ Definition is visible to all companies on the same
database server. When the Epicor application uses multiple companies contained within a single database,
the BAQ usage and visibility is applied regardless of multi-company direct configuration. For companies
hosted on different databases, this check box initiates the Service Bus processing, when it is configured to
synchronize BAQs to external companies. If the custom BAQ is created from a Company that is running
under a multi-tenant license, the definition becomes visible to all companies within the same Tenancy as
the Owning Company. The BAQ definition can only be updated from the original company, but is available
for execution and review in other companies.

13. The Use Primary Database field indicates if this execution setting is enabled for the BAQ.
For details on the Use Primary Database feature, please refer to the Actions Menu > Execution Settings
topic.

14. Select the system query you need and click OK.

15. The Change Security Code command allows selecting custom Security codes and apply them to System
BAQs. If a seeded System BAQ already references a System Security code as assigned by Epicor, it is possible
for customer administrator to control user access by creating a custom Security code record and allow or
disallow access to users or user groups, and assign them to System BAQs. In On-Premise and Multi-Tenant
environments a user can apply one Security code to any System BAQ. The applied Security code allows user
access to a system query in all on-premise companies, as well as in all companies within the tenancy.

Only a user with Security Manager rights is allowed to


make changes to a System BAQ.

10.2.700 29
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Custom Queries

You create your own queries in the Business Activity Query (BAQ) Designer program.
When you create custom queries, make sure you query database tables that are indexed in the Epicor Data Model.
The Epicor database contains a number of internal system tables that are not part of zData. When run from the
ERP application, queries that request data from such tables end up in failure. Use the Data Dictionary Viewer tool
to check if a specific table belongs to the Epicor Data Model.
Furthermore, the BAQ Designer also takes into account additional table metadata stored in the Epicor Data Model
- for example, detailed description, data format, Like columns from other tables, or applied security restrictions
(by Territory ID, Site/Plant, etc.). So if a table has been designed to display only for one specific site, you will not
be able to query it from another.
Some table fields and tables may have availability restrictions based on their pertinence to a specific
Country/Country Group Code (CGC Code) used in development of Country Specific Functionality (CSF). In the
BAQ Designer, you can query such fields or tables only from the Companies with a matching Country Code or
Country Group Code, if any. For example, the Erp.Customer.MXMunicipio field is available for querying only if
you have the Mexican CSF package installed and the current Company has the MX (Mexico) Country Code
assigned to it.

New Business Activity Query

The Business Activity Query Designer program contains multiple sheets through which you define the query
criteria and indicate how the data displays through the executed query. The content and purpose of each sheet
is described in this section.

The General Sheet

Use the General sheet to create your query; you define the query’s identifier and description here. You also
indicate whether this query should be made available to all users within the company, support data updatability,
if you want to share this query between multiple companies and if the query should retrieve results across
companies.
In this example, you create a query that displays all open sales order detail lines.
The QueryPhrase text box displays the query you created. The resulting SQL statement is a pseudo SQL statement
that indicates how the query is executed.

When a BAQ is executed, Today and other dependent


constants, as well as the current date value for current
date-based condition, are calculated one time per query run,
and their values are based on company time zone of the
company from which the BAQ is executed. For Cross-Company
BAQ, it means the value of Today and dependent constants is
calculated based on company time zone of user’s current
company; it is not recalculated for each company from which
the data is retrieved by Cross-Company BAQ.

Define Business Activity Query Attributes

1. Click the New button.

30 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. In the Query ID field, enter a value. In this example, enter SalesValue.


When creating a new Business Activity Query, the originating company information is attached to the BAQ
behind the scenes.

A Query ID can only contain letter characters, digits,


dashes, or underscores. It cannot begin or end with a
dash or an underscore.

3. In the Description field, enter a concise explanation for the query. In this example, enter Total Value of
Quotes, Orders, Invoices by Date.

4. Notice the Author field displays the name of the user who created the current business activity query. Other
users cannot modify the current query. If you need to assign author rights to another user, use the Actions
> Change Author option.

5. The Owning Company displays the company inside which the current BAQ was created. You cannot change
this value; only users within the Owning Company can modify this BAQ.
If the All Companies check box is selected, then companies within the same organization as the Owning
Company can view and use the query. If the System BAQ check box is selected, the Owning Company field
is blank. This indicates the current BAQ is available to all companies within the current organization.

6. The Shared check box indicates this query is available to all users. After you save the query, all users in your
company can utilize this query using the available BAQ consumers, such as Quick Searches, BAQ info zones,
BAQ reports, and dashboards. Note these users will need various rights to use these features.

To learn more about creating your own dashboards, refer


to the Dashboards chapter. For more information about
how to use global BAQs and the multi-company
functionality, review the Multi-Site Technical Reference
Guide available within the application help.

7. The All Companies check box controls whether the current BAQ Definition is visible to all companies on
the same database server. When the Epicor application uses multiple companies contained within a single
database, the BAQ usage and visibility is applied regardless of multi-company direct configuration. For
companies hosted on different databases, this check box initiates the Service Bus processing, when it is
configured to synchronize BAQs to external companies.

10.2.700 31
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

If the custom BAQ is created from a Company that is running under a multi-tenant license, the definition
becomes visible to all companies within the same Tenancy as the Owning Company.
The options/values for tenant and multi-tenant features are only for Epicor hosted environments. Typically
you can ignore these options. Internal Epicor administrators who need more information should refer to
the Epicor SaaS Installation Guide.

The following rules apply to usage of BAQs visible across companies:


• The BAQ definition can only be updated from the original company, but is available for review and
execution in other companies. To modify the BAQ definition in other companies, you need to create a
copy of the BAQ.
• The BAQ ID of queries having the All Companies property must be unique across all companies.
• When you create a BAQ visible across companies in Company A, and Company B uses a local BAQ with
the same ID, a warning message displays. A user is informed that in Company B, the local BAQ is used
and the BAQ created in Company A will not be available for use.
• Likewise, when you create a local BAQ in Company A and a BAQ visible to all companies, having the
same ID, already exists in the Company B, a warning message displays. A user is informed that the local
BAQ will take precedence over the All Companies BAQ. The same principle is true for the BAQ import
process.

The local BAQ always take precedence over the BAQ


visible to all companies, when the naming conflict
occurs.

To see in which companies (outside the current company), references to the BAQ were created, use the
Where Used tabs.

8. The System BAQ check box indicates whether the current BAQ is installed with the Epicor ERP application.
If the current BAQ is a system BAQ, you cannot make changes to it.
This information displays in the read-only format.

9. By selecting the Updatable check box, you indicate the current query allows performing database updates.
This option activates the sheets under the Update tab; use these sheets to indicate which fields will be
available for data entry through this query. You can place an updatable BAQ on both smart client dashboards
and mobile device dashboards.

When you select this option, the Use Primary Database


option in the Execution Settings is selected
automatically.

To learn how to utilize updatable queries, see the Updatable Business Activity Query section later in this
chapter.

10. The Cross-company check box controls if the BAQ brings back results across multiple companies.
In order to use this function, a selected user must have the ability to create cross-company queries.

11. Click the Security ID button to search for and select a security code used to give or block access to the
BAQ for specific users. Security codes limit access to user groups, specific users, and/or both; the codes are
configured in the Menu Maintenance program.

This field is disabled for system BAQs. Security Managers


can update the Security Code applied to a system BAQ
by using the Change Security Code action.

32 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

12. When you finish, on the Standard toolbar, click Save.

The Query Builder

Use the Query Builder sheets to design a Business Activity Query. Use this sheet to set up everything from basic
queries with a single table to complex queries including multiple subqueries of different types, joins or query
parameters.
The Phrase Build sheet is where you select the tables and fields you wish to include in the query. Use this sheet
to set up everything from basic queries with a single table to complex joins between multiple tables.
Several sheets are available at the bottom of the Phrase Build sheet. Use these sheets to indicate how tables are
linked together, define the relation between the tables, and specify the selection criteria for the query.
The Display Fields sheets define which columns display and in what order they display in the query. You can
also create and display a special calculated field you need within the current business activity query and indicate
if you want to sort BAQ results through any combination of columns.
The SubQuery Options sheet is where define subquery properties. When you construct a BAQ, use this sheet
control what data displays in the SQL output by selecting an appropriate subquery type. You also have the ability
to control the SQL results set. For example, you can construct an SQL text to only display top 50% of rows from
the retrieved results set.
The SubQuery List sheet displays the read-only information of all subqueries created within the BAQ. All
subqueries are ordered by the sequence number. Using this sheet, you can change the order of subqueries to
define how partial query texts are concatenated in the final SQL statement.

Add Table

Use the Phrase Build sheet to design a query using the visual representation of the query.

1. On the left pane, Epicor ERP tables, Extension tables within the database are displayed in the table palette.
Select a table you want to add.

10.2.700 33
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. To easily locate the table you want, in the Filtering field, enter a value.
By default, the filter is applied to all tables whose names (excluding the schema part of the table name) start
with the string you enter in the filtering box. In this example, enter Quote to narrow down the list of tables.

3. When you select the Contains check box, all tables that contain a filtering substring you enter in the Filtering
field display.

4. In the left pane, above the list of tables, the three buttons control the list of available objects you can select
and drag on the designer canvas:
• Connected Only - When selected, the palette displays only the tables that have relations, described in
system tables, with the table you select on the canvas. The table palette displays Extension Table when
connection with selected table is defined in Extension Table settings.
• SubQueries - When selected, the palette displays subqueries of InnerSubQuery or CTE type created
within the current BAQ. You can drag these subqueries on the canvas and use in the JOIN clause as any
ordinary table.
• Table-Valued Functions - When selected, the palette displays all Table-Valued Function (TVF) defined
in the application. A Table-Valued Function is a user-defined function that returns a table. Currently, this
feature is only supported in External Business Activity Query.

5. The central part of the form contains the canvas where tables are dropped.

34 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. To include a table in your query, select a table and drag it on the canvas in the center pane.

To perform multi-selection, hold Ctrl or Shift and select


tables you want to include in the BAQ.

BAQ Designer displays extension tables relevant to the


current company in table list. Table information, as well
as Field information, is displayed when you select the
table. Fields from extension tables are used similar to fields
from regular tables.

Peer Extension Table Columns display as a part of their


main table and follow the
<SystemCode>_<TableName>_<FieldName> naming
pattern.

Additional Controls

Several additional Phrase Build controls help you construct the query.

1. To create a manual connection between two tables, click the Add Connection button. Select the first table
you want to link; drag the line and drop it on the table you want to connect to.
For more information on table connections, review the Phrase Build > Table Relations topic.

10.2.700 35
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. If you want to remove a table or an existing connection from the query, select it on the canvas and click
Remove Selected.

3. Instead of selecting tables individually, you can use the Business Objects button to search for and load
table(s) within an entity, for example, ERP.Part. These tables are organized as hierarchical nodes under the
business objects, User can inspect these tables and drag some of them on the canvas. Dragging the parent
node results into adding all child nodes also. The links between loaded tables are displayed automatically.

You cannot select multiple tables/objects at once.

4. The Toggle IsSummary Flag button is an Epicor 9 legacy feature, which should be used ONLY with legacy,
migrated BAQs to simulate Epicor 9 summary table behavior. Users should not use this option when creating
new BAQs as this flag does not support new features such as subqueries. New BAQs should use standard
SQL syntax with GROUP BY and HAVING, and SQL aggregate functions to create aggregate queries.

5. You can use the options on the Arrange Diagram list to modify how the tables display on the grid. Available
options include:
• Diagram Overview - Displays the query in its default view mode.
• Zoom - Select this option to turn on zoom mode. When you click the tables in the grid, they increase
in size.
• Fit to Screen - Displays the entire query through a high level view.
• Layout Tables Automatically - Places the tables in a default order. The order of tables can be set on
the Table List sheet. Current positions of tables within a subquery is represented by numbers in the upper
left corner of table rectangles.

6. The right pane contains the description and list of the columns on the selected table. You can use the
Filtering edit box to only view the columns, with names that start with specified letters and sort column
names (alphabetically or in database order).

Table Relations

Use the Table Relations sheet to display and modify the fields that make up the joins between tables and
subqueries. You can add, modify and delete the join fields within the current query.
By default, queries are set up to display Matching rows from {left joined table} and {right joined table},
which means that data from the first table only displays if it is linked to data within the second table. The query
output from this type of join includes all the records in which the table relations values in both tables are an exact
match. Records from either table that do not have a match in the other table are not included in the query results.
For example, use the matching rows join to view all customers and the orders they have placed. You will not get
a match for any customer who has not placed orders. Most queries you create only need this type of join.

It is crucial a user explicitly determines the correct order of


tables in the query to retrieve the expected results.

You can use the following join types to retrieve the expected BAQ results:
• Matching rows from {left joined table} and {right joined table} - only rows satisfying join criteria from
both joined tables are selected. By default, tables are linked through this type of join.

36 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Example
The join between the Customer table1 and the OrderDtl
table2 creates a view that displays customers and orders
placed. In this case, the view includes only customers who
have placed an order. Records for any customers who have
not placed an order are excluded.

Use this join to display only matching records between the primary table and the lookup table.
• All Rows from {left joined table} - rows satisfying join criteria from both joined tables are selected as well
as all remaining rows from left joined table are kept along with Nulls instead of actual right joined table values.

Example
Use the All Rows from {left joined table} join to view all
customers (table1) and the orders (table2) for these
customers, and to retrieve a row for every customer who
has not placed any orders. Fields that otherwise hold the
order information display blank for these customers.

• All Rows from {right joined table} - rows satisfying join criteria from both joined tables are selected as
well as all remaining rows from right joined table are kept along with Nulls instead of actual left joined table
values

10.2.700 37
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Example
Use the All Rows from {right joined table} join to find each
employee (table1) and his or her department (table2), but
still show departments that have no employees.

• All Rows from {left joined table} and {right joined table} - rows satisfying join criteria from both joined
tables are selected as well as all remaining rows both from left joined table and right joined table are kept
along with Nulls instead of values from other table.
In SQL, this type of join combines the results of both left and right outer joins and returns all (matched or
unmatched) rows from the tables on both sides of the join clause.

Predefined Dictionary Relations

When two tables are placed on the canvas, and relation between tables is described in the dictionary, the relation
is drawn by the BAQ automatically. The relation is represented by the line that indicates the JOIN clause. You
can also create table relations manually or replace existing ones.
To automatically connect tables:

1. Click the Connected Only button (the chain link icon) to only display tables appropriate for linking with
the selected table that displays on the grid.

38 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click and drag another table to the grid. In this example, drag and drop the Customer table on the center
pane.

3. When two tables are placed on the canvas, and relation between tables is described in the dictionary, the
relation is drawn by the BAQ automatically. The relation is represented by the line that indicates the JOIN
clause. Automatic creation of JOINs is supported between standard Epicor tables, between Epicor tables
and Extension tables, and between Extension tables.

4. When the relation involves two standard tables, by default queries are set up to display the Matching rows
from {left joined table} and {right joined table} join type, which means that data from the first table
only displays if it is linked to data within the second table. The query output from a Matching rows join
includes all the records in which the table relations values in both tables are an exact match. Records from
either table that do not have a match in the other table are not included in the query results. When relation
is between Standard and Extension tables, by default it is set up to display the All Rows from {left joined
table} join type, which means that join criteria includes all rows from Standard table, while only including
matching rows from Extension table. Data on relations between two tables is selected from Extension Table
settings. When relation includes two Extension tables, by default it is set to include all rows from the parent
table, and only matching rows from the child table.
The available types of joins are discussed on the Phrase Build - Table Relations topic.

5. You can use the Dictionary button to view and select one of the predefined relations between tables. This
is supported for relation between Standard tables, between Standard and Extension tables, and between
two Extension tables. When two tables are placed on the canvas, and relation between tables is described
in the dictionary, the relation is automatically defined by the BAQ.

10.2.700 39
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

As tables are placed on the canvas subsequently, the newly added table always checks relation with the
previous table within the table order. It does not check relations to all possible tables within the query. This
button is enabled when some predefined relation exists in the dictionary for the selected join connection,
and its title contains number of predefined dictionary relations in the parentheses.

6. The Table Relations from Dictionary window that displays when you click the button lists all relations
with their fields. The result relation expression displays in the Expression text box at the bottom. You can
select one of the relations and press the Replace In Query button. As a result, fields from the Dictionary
form will replace fields used in the current BAQ relation.

7. In this example, accept the default relation between tables using the Company and CustNum columns.

40 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Manually Connect Tables

If you want to join tables or subqueries with no predefined relations in the system, you must manually create
these relations. You can also replace or modify existing relations by building an expression of your choice.
To manually create a relation between tables:

1. To create a join between tables or subqueries, click the Add Connection button.
The cursor turns into the cross.

10.2.700 41
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Create a join between tables using the drag and drop functionality.
The tables are connected with the line. In this example, assume you would like to create a business activity
query that displays the list of parts and for each part you would like to attach a detailed company information.

3. At the bottom of the screen, the Table Relations sheet is automatically selected.

42 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

4. To define the relation between the tables, on the Table Relations sheet toolbar, click the Add Row button.

5. Create a join between the first and second table. In this example, you select the Company column to join
Part and Company tables.

You have the following options to create a relation:


• Create a simple join between table fields using the
field1 = field2 pattern.
• Construct an advanced expression, for example, using
functions or operations different from = (equals). There
is no list of predefined operators, you can enter a
custom expression of your choice.

6. If the BAQ designer determines a non-standard expression, it displays the Fx symbol in the middle of the
join square on the link.

10.2.700 43
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. In the Join Type field, select a desired type of join to combine records from two tables to construct your
query. The available types of joins are discussed in the Phrase Build - Table Relations topic.

When tables you add are not joined by any field, the
CROSS JOIN (Cartesian join) is automatically selected.
This join returns all records where each row from the first
table is combined with each row from the second table.

It is not possible to add a new connection to the already


connected tables. Instead add new fields on the Table
Relations tabs at the bottom of the page.

Table List

The Tables List sheet displays the list of tables and subqueries you place on the canvas for the subquery in focus.
The first table listed in the FROM clause of the resulting SQL statement is explicitly set on this sheet. The order
of the other tables is based on table relations.

1. If your BAQ incorporates multiple SubQueries, switch between them using the Active SubQuery navigational
toolbar found above the Phrase Build sheet.

44 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. The current position of a table within a subquery is represented by a number in the upper left corner within
the table rectangle.

3. In this example, the QuoteHed table is the first table within the table order.

4. Notice what the current resulting SQL syntax looks like.

5. To change the order of tables, select a table and use the Up or Down arrow on the toolbar to move the
selected table one position up or down. Repeat this action the required number of times to move the table
several positions up or down to define the new table order. In this example, select the Customer table and
click the Up arrow to make it the first table on the list.

10.2.700 45
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Notice the change in the resulting SQL syntax.

The correct order of tables is crucial for retrieving the


expected BAQ results.

Table Criteria

Use the Table Criteria sheet to limit the data that displays in the BAQ results by adding filtering conditions for
the selected table.
When you add a filter to the table, the following rules apply:
• If the table with applied filtering is the first table in the BAQ, then these criteria go to the WHERE part of the
resulting SQL statement.

46 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

• If the table with applied filtering is not the first table in the BAQ and is connected to the previous table with
join, then within the resulting SQL statement, these criteria will be applied to the JOIN clause in the ON
condition.

You should consider leaving the query criteria open. You then
have more flexibility within the query, as you can always add
a filter to the query results within a dashboard or a BAQ report.
For more information on this functionality, review the BAQ
Report Designer and Dashboards chapters.

To create a table filter criterion:

1. Select a table on the canvas from which you want to filter the data. In this example, select the QuoteHed
table. Notice the table with a filter applied displays the "+criteria" indicator on the table rectangle.

2. Click the Sort Columns Alphabetically button to display the fields on the drop-down lists in alphabetical
order.

3. Click the Add Row button on the toolbar.

4. A new row displays on the grid; enter the options you need for this filter. In this example, you add a filter
that causes the query to only display quotes that are currently active.

5. The And/Or field defines the criterion string clause in relation with other criterion on this sheet. Use this
field when you need to apply a filter based on the values of more than one criterion.

10.2.700 47
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Use the ( and ) fields to insert the left and right parenthesis to the clause. You can enter as many parenthesis
characters as you need to complete the order in which you want the criteria to filter the results.

7. If you want this criterion to evaluate a Not criterion value, select the Not check box. This Not value indicates
you want a value returned not like the evaluating value; for example, a column NOT IsNull.

8. From the Field drop-down list of fields of the table selected on the canvas, select the QuoteClosed field.

9. The Compare (operator) list defines how the selected field is evaluated against the Filter Value. In this
example, select = (equals) option. The Filter Value can be an alphanumeric value. You have the following
options:

Operator Description
> Greater than
< Less than
= Equals
>= Greater than or equals
<= Less than or equals
<> Not equal or not identical to
BEGINS Returns data that starts with the same characters. Although this operator is less efficient
compared to the Greater than or Equal sign (>=), you can use this value to pull in a series
of records that start with the same set of alphanumeric characters.

This operator is only used for backward


compatibility with legacy ABL/Progress
BAQs used in the Epicor 9 application.

MATCHES Returns data that is exactly the same as the character string. Although this operator is less
efficient compared to the Equal sign (=), you can use asterisk wildcards to pull in data. For
example: MATCHES '*owe*' finds both owe and powerful. With MATCHES, you can use
no asterisks, a left asterisk, a right asterisk or both asterisks.

This operator is only used for backward


compatibility with legacy ABL/Progress
BAQs used in the Epicor 9 application.

ISNULL Returns fields that have an unknown, or "NULL" value.


• If you want to find rows with the EMPTY string value, use comparison with an empty
constant. The example of an empty constant looks as follows:
SELECT AbcCode from Erp.AbcCode where AbcCode.Company <> ''

• If you want to find rows with unassigned fields, use the ISNULL operation. This
operation may be useful in external queries which execute against non-Epicor
databases.

IN Indicates this value is used with either a list of constant values or a BAQ item list parameter,
or a field from an inner subquery.
You can also use this criterion for updatable BAQs.

48 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Operator Description
CONTAINS Returns data when the selected character field has data which is present within the defined
Filter Value.

In MSSQL, CONTAINS only works when


a field is fully indexed; otherwise, the
following error is thrown:

Msg 7601, Level 16, State 2, Line 1 Cannot use a CONTAINS or FRE
ETEXT predicate on table or indexed view 'Erp.Abccode' because i
t is not full-text indexed.
This field is a predicate used in a WHERE clause to search columns containing character-based
data types for precise or fuzzy (less precise) matches to single words and phrases, the
proximity of words within a certain distance of one another, or weighted matches. This
operation can be applied against column of following data types and its derived types:
• char
• text
• image
• xml
• binary

EXISTS The EXISTS condition is considered to be met if the SubQuery returns at least one row. This
condition can be used in any valid SELECT SQL statement. The syntax for the EXISTS condition
is:

SELECT columns
FROM tables
WHERE EXISTS ( subquery );

When you select the EXISTS operator, in


the Filter Value field, you can only select
the a row in specified subquery
option.

If the subquery is not specified for EXISTS


condition, the QueryPhrase text box
displays where (exists<not selected
subquery>) statement.

LIKE Allows usage of SQL Like syntax. It determines whether a specific character string matches
a specified pattern defined in the filtering value. A pattern can include regular characters
and wildcard characters.

10. Click the Filter Value drop-down list to define how this criterion filters data. Each option displays with
hyperlink text; click this hyperlink text to define the filter values. The next section describes each of these
options in more detail. In this example, select the specified constant option. Click the specified link.

11. The Specify Value window displays.

10.2.700 49
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. In the Value field, enter the constant value you need. In this example, enter False as you want the query to
return open quotes.

13. Click OK.

14. Notice the word False now displays as the filter value.

15. Continue to add the criteria you need. When you finish, click Save.

16. You can now view your query; navigate to the General sheet.

17. The Query Phrase text box displays the query you created. Notice your criterion is included as part of the
resulting SQL syntax.

50 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

The Query Phrase is generated to review your query


design only. The actual query may contain additional
statements that are injected by the framework during
query execution - for example, company or security
filtering, or input parameters. Executing this query outside
Epicor ERP may produce a different result.

SubQuery Criteria

Use the SubQuery Criteria sheet to narrow down BAQ results by adding filtering conditions on the selected
SubQuery.
When you add a filter to the SubQuery, the following rules apply:
• In the resulting SQL statement, the SubQuery criterion displays in the WHERE part of the SubQuery.
• When you select the Having check box to indicate the SubQuery should meet specified conditions, the criterion
displays within the SubQuery's HAVING part of the resulting SQL statement.
For more information on creation of SubQueries, read the SubQuery Options topics.

1. If your BAQ incorporates multiple SubQueries, switch between them using the Active SubQuery navigational
toolbar found above the Phrase Build sheet.

10.2.700 51
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Navigate to the SubQuery Criteria sheet.

3. Click the Add Row button on the toolbar.

4. A new row displays in the SubQuery Criteria grid; enter the options you need for this filter. In this example,
the BAQ is comprised of two SubQueries returning the list of Quotes and Orders. You will limit the BAQ
results by adding a filter to each SubQuery. For the Quotes SubQuery, add a criterion to only return quotes
for the customer Addison.

5. Entering a condition for the SubQuery is similar to entering Table Criteria discussed in the previous topic,
except in a SubQuery, first use the Table field to select a table from the current SubQuery or a predefined
Calculated table name, when referring to calculated fields. In this example, select the Customer table.

6. Build the criterion by selecting the SubQuery Field, Operation and Filtering Value. In this example, create
a criterion to only retrieve quotes from the customer Addison.

7. When you select the Having check box, the SQL statement returns rows where aggregate values meet the
specified conditions. Typically you use this field with the calculated field editor.

8. If you want to apply criteria to another SubQuery, use the Active SubQuery navigational toolbar to select
it.

52 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Enter the criteria for the second SubQuery. In this example, limit the BAQ results to only retrieve orders for
the customer Dalton.

10. You can now view your query; navigate to the General sheet.

11. The Query Phrase text box displays the query you created. Notice the filtering is applied to each SubQuery
within the resulting SQL syntax.

10.2.700 53
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. The following is the BAQ result returned by the query.

54 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Filter Values

The previous sections described how to create a criterion using the specified constant filter value. This section
now discusses each of the Filter Value options, explaining what you can define on each option.

Specified Table Field Value

Use this option to filter the data using a field from a table included in the query.

1. From the Filter Value drop-down list, select the specified table field value option.

10.2.700 55
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the word specified.

3. The Select Table window displays.

4. In the Subquery field, select the name of the subquery used to filter data.

By default, the current subquery is selected.

5. From the Table drop-down list, select the table that contains the fields you want to filter against. All the
tables available in your current subquery display.

6. All the available fields display in the fields section. Select the field you want to use in the criterion.

7. Click OK.

8. The field value displays in the Filter Value column.

56 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Specified Constant

Use this option to filter the data against a specific value you define. To use this option, do the following:

1. From the Filter Value drop-down list, select the specified constant option.

2. Click the specified link.

3. The Specify Value window displays.

4. In the Value field, enter the value you want to filter against. You can enter any text value you need.
Depending on what you enter, some values may or may not be case sensitive.

5. Click OK.

10.2.700 57
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Your specific value displays in the Filter Value column.

Specified Expression

Use this option to filter the data against a specific expression you create. You can use this filter to build complex
expressions that are calculated when the criterion is applied to the query.
To create an expression:

1. From the Filter Value drop-down list, select the specified expression option.

2. Click the specified link.

3. The Specify SQL Expression window displays. To help you create expressions, the Editor window contains
lists of available fields, functions, and operators. You can add these items to an expression by either
double-clicking them or dragging them onto the editor window's Editor field.

58 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

The editor supports intelligent code editing, which includes invoking member lists. To bring up a list of
columns for a table, enter the name of the table followed by a dot (.) and press Ctrl + Space. Select the
column you need, it will be added to the table name. For example, ABCCode.Company.

4. Click OK.

5. Your specific value displays in the Filter Value column.

Specified Parameter

Use this option to filter the data using an alternative parameter value you define. These parameters can be nearly
any value you need.
You can also use parameters to display customized method arguments for use in Business Process Management
(BPM) directives.
The query text contains references to arguments using this format: @arg_name

Example

select * from dbo.PartCOPart as PartCOPart


where PartCOPart.CoRevisionNum = @CustomParameter
This argument reference is replaced by the argument value when the query activates.
To select this option and create a new parameter:

1. From the Filter Value drop-down list, select the specified parameter option.

10.2.700 59
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the specified link.


The Select Parameter window displays.

3. To create a new parameter, click the Define… button.


The Query Parameters window displays.

4. Enter the Parameter Name you want for your new parameter value.
This name cannot contain any spaces.

60 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. From the drop-down list, select the Data Type for the parameter. Available types:
• nvarchar
• int
• decimal
• date
• datetime
• bit
• uniqueidentifier
• bigint

6. In the Format field, the default format for this Data Type displays.
If you need, you can edit this value. Be sure the format follows the convention of the database.

7. If this parameter is required in order for the BAQ to pull in query results, select the Mandatory check box.

8. Use the Editor Type drop-down list to select how you will define the parameter values. Available options:

Option Description
Common Editor Activates the Default Value field. Enter a custom text value you need for the
parameter. The field selected on the criterion is then evaluated against this default
value.
Radio Button Set Activates the Values Editor sheet. Use this sheet to define the various radio button
options this parameter will use. The field selected on the criterion is then evaluated
against these multiple options.

10.2.700 61
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Option Description
DropDown List Activates the Data from drop-down list. Use this list to define the source of the
drop-down list options. The field selected on the criterion is then evaluated against
the options contained on the drop-down list.
Item List Use this option the create the list of values this parameter will use. The field selected
on the criterion will then be evaluated against these item list options. For this option,
BAQ execution expects the list of values transmitted in the ExecutionParameter
table, instead of a single value.
This parameter is only used with the IN operation.

9. If you select the Common Editor option from the Editor Type drop-down list, the Default Value field
activates. Enter the default value you want within this field.

10. Select the Skip condition if empty check box when you want the BAQ to ignore this parameter if it returns
a blank, or empty, value. If parameter is not supplied, the BAQ ignores the criterion with this parameter.
For example, in the condition StartDate > @param1, the param1 value returns null. If the Skip condition if
empty check box is selected, the BAQ does not check the criterion specified for the StartDate field.

BAQ parameters having this property enabled are not


available for use within the Calculated Field Editor. If a
query parameter is referenced in a calculated field, and
then this check box is enabled for the parameter, on
analysing or saving the query, the following error message
is presented to the user: "Expression of calculated field
<FieldName> references optional query parameter
<ParameterName>".

11. If you select the DropDown List option from the Editor Type drop-down list, the Data from field activates.
Use the options from this drop-down list to indicate the source from which the data on this list populates.
Available options:

Option Description
Custom The Values Editor displays controls for creating a new list of values. Use this functionality
Values to define the various list options this parameter will use. The field selected on the criterion
will then be evaluated against these item list options. Enter the following information:
• Value - Enter the actual value of the parameter that is sent to the query.
• Display text - Enter the text displayed for the user for this value.
• Order - Defines the sequential order of items in the list.

BAQ The Values Editor displays controls for selecting a BAQ. Enter the following information:
• Query ID - search for and select the BAQ you need.
• Display Column - select the column that displays in the lookup list.
• Value Column - defines the name of the column you want to use for the parameter
value.

62 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Option Description
User Codes The Values Editor displays the control for selecting a specific user code.
User codes are lists of custom values you define through User Defined Codes
Maintenance. When you select a user code, its list of values is compared against the
field selected on the criterion. For more information about creating user codes, review
the User Defined Codes Maintenance help topics.

12. When you finish defining the parameter, click Save.


Continue to create as many parameters as you need.

13. When you finish, exit the Query Parameters window.

14. Your new parameter displays in the Select Parameter window. Highlight the parameter you created.

15. Click Select.

16. Your parameter displays in the Filter Values column.

17. You can also create parameters through the Actions menu. To do this, from the Actions menu, select
Define Parameters.

10.2.700 63
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

BAQ Special Constant

Use this option to filter against a specific constant, like CurrentCompany, CurrentEmployeeID, First Day of the
Month, Fiscal Period, and so on. The query pulls data based on the BAQ constant you select.
To define a BAQ special constant:

1. From the Filter Value drop-down list, select the BAQ special constant option.

64 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the special link.


The Select BAQ Constant window displays.

3. In the Select BAQ Constant window, select one of the constant options available from the list.

4. Click OK.

5. The selected BAQ constant displays in the Filter Values column.

To review the complete list of BAQ constants, see the


Calculated Field: BAQ Constants topic.

Current Date + Specified Number of Days

Use this option to filter query results by date intervals: days, weeks, months, and years. The result is always
evaluated against the current company date (TODAY). You can enter a positive or negative value; the value is
then added or subtracted from the current company date to calculate a different date.
To filter query results by a date interval:

1. From the Filter Value drop-down list, select the Current date + specified interval option.

10.2.700 65
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the + specified interval link.


The Select Date window displays.

3. Use the arrow buttons and the drop-down list to define the next BAQ execution date.

The current date is retrieved from Constants.Today. This


constant allows to set the date according to the time zone
based on the company location.

4. Click OK.

5. The interval in days you defined displays in the Filter Value column. The query pulls in records that have a
date equal to or greater than the interval you defined ahead from the current company date. In this example,
the query pulls in records that have a date equal to or greater than five days ahead from the current company
date.

66 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Select Value(s) of Field From Specified Subquery

Use this option to filter the data using values of a subquery field(s) you define.

Example Create a simple query and add a new inner subquery


with one display field. On the main subquery, create a filter
using a scalar operation, for example, <>=. In the Filter Value
field, select the inner subquery you created.

1. From the Filter Value drop-down list, select the selected value(s) or field from specified subquery option.

2. Click the word selected.


The available options:
• ALL - the condition evaluates against all values returned from a subquery.
• ANY - comparison with at least one value returned from a subquery.

3. Click the field from specified link.

4. In the Select SubQuery Field window, the list of subqueries of the InnerSubQuery or CTE type displays.

5. Select a Subquery you want to use.

6. Select a Field against which you want to filter data.

10.2.700 67
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Click OK.

8. The subquery field you defined displays in the Filter Value column.

Operation Specific Filters

For certain operations, only specific filters are available for use.
The table below displays which filters become available when you select the following operations:

68 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Operation Available Filter(s)


IN operation
• specified constants list
Use this filter to specify the list of constants.
• specified list parameter
Use this filter to select an Item List parameter you want to use in the query execution.
This parameter contains a list of values supplied during query execution.
• field from specified subquery
Use this option to filter the data using a subquery field(s) you define. You can select
fields from subqueries of the InnerSubQuery or CTE type.

EXISTS operation
• a row in specified subquery
Use this option to filter the data using a subquery you define. You can select a subquery
of the InnerSubQuery or CTE type.
This operator only checks the row is returned.
If the subquery is not specified for EXISTS condition, the QueryPhrase text box displays
where (exists<not selected subquery>) statement.
When you select the EXISTS operator, in the Filter Value field, you can only select the
a row in specified subquery option.

CONTAINS
• specified contains expression
operation
Use this filter to launch the Specify Expression window. Use this form to create an
expression compatible with the CONTAINS predicate in SQL. Supported terms: AND
(&), OR (|), wildcard (*), parentheses (()). Full-text indexed column is required.

Function Call Parameters

Use the Function Call Parameters sheet to specify values for the parameters in a Table-Valued Function.

This option is only available in External Business Activity


Query.

A Table-Valued Function (TVF) is a user-defined function that returns a table. To view the list of TVFs available
for use with your product, click the Table Value Function button above the left panel on the Phrase Build
sheet.
TVFs typically require input parameter values. The Function Call Parameters sheet is populated when you add a
TVF to the grid. To be able to retrieve results from the TVF, you must define an expression in the Value field of
each listed parameter. This can be done by manually typing an expression or by using the expression editor that
displays when you click the ellipses button.

10.2.700 69
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Add Function Call Parameter Values

This procedure discusses adding parameter values when adding a Table-Valued Function (TVF) to an External
Business Activity Query (BAQ). You also can select an existing TVF on the grid and edit the parameter values.
To use the TVF function:

1. Display the TVFs available for use with your product.


On the Phrase Build sheet, click the Table-Valued Functions button above the left pane.

2. Click and drag a TVF to the grid.


On the grid, the TVF rectangle displays in red color.

3. By default, the Function Call Parameters sheet is selected.


Adding the TVF to the grid populated this sheet with a list of all parameters in the TVF.

4. Add an expression in the Value field of each listed parameter.


Enter the expression manually or click the ellipses button to open an expression editor. To help you create
expressions, the editor window contains lists of available fields, functions, and operators. You can add these
items to an expression by either double-clicking them or dragging them onto editor window's Editor field.

5. When you right click on a red TVF rectangle on the canvas, you can use the context menu to set the APPLY
operator.

70 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

The following options are available:


• CROSS APPLY - when selected, only rows from the outer table that produce the result set from the TVF
are returned.
• OUTER APPLY - when selected, either rows that produce the result set as well as those that do not,
with NULL values in the columns produced by the TVF are returned.
If the APPLY operator is set for TVF, it is used instead of the join expression. The selected operator specifies
how the TVF is invoked for each row in the result set. The result set is created by tables that precede the
TVF within the table order. If the preceding table and TVF are connected through the join, the APPLY operator
is ignored.

Example The below BAQs demonstrate usage of the


APPLY operator. Either of the below BAQs return the same
results.

SELECT * from dbo.activity OUTER APPLY dbo.p21_fn_split(…)

10.2.700 71
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Pivot SubQuery FOR Clause

You can use the PIVOT operator within a query to transform data from row-level to columnar data.
PIVOT rotates SubQuery results by turning the unique values from one column in the expression into multiple
columns in the output, and performs aggregations where they are required on any remaining column values that
are wanted in the final output.
Creation of PIVOT statements within a BAQ is available for the InnerSubQuery or CTE SubQuery types. To
activate the Pivot SubQuery FOR Clause sheet, place a SubQuery on the canvas. Right-click the SubQuery
rectangle and select PIVOT > SET PIVOT. To create an aggregation formula used within the PIVOT statement,
click the ellipsis button to invoke the Pivot Aggregate Expression Editor.

Aggregate Data Using Pivot

In this example, build a query against the OrderHed and Customer tables to determine the number of sales orders
placed by each customer throughout the selected years.
To use the PIVOT operator:

1. Create a BAQ comprised of two SubQueries. In this example, you display the aggregated data through
TopLevel SubQuery1. For the moment, leave this first SubQuery intact.

2. For the second SubQuery type, select InnerSubQuery.

72 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

You can use either the InnerSubQuery or CTE Subquery


types to aggregate data using the PIVOT operator. When
a CTE SubQuery is used, it must be placed as the first
SubQuery as it provides the base data for the rest of the
process for fetching the data.

3. In SubQuery2, place the Erp.OrderHed and Erp.Customer tables on the canvas.

10.2.700 73
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. For the DisplayColumn(s), select Customer_CustID and OrderHed_OrderNum columns.

74 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Now create a calculated column that displays the order creation year.

6. To get the year part of the date on which a sales order was placed, use the datepart(year, expression)
function. The expression looks as follows:
datepart(year,OrderHed.OrderDate)

7. Now switch back to SubQuery1 and place SubQuery2 on the canvas.

10.2.700 75
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. Right-click the SubQuery2 rectangle and select PIVOT > Set PIVOT.

9. Notice the word PIVOT displays on the rectangle and the Pivot SubQuery FOR Clause sheet becomes
enabled.

76 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. Click the ellipsis button to invoke the Pivot Aggregate Expression Editor.

11. Use the Pivot Aggregate Expression Editor to create an aggregation formula.

10.2.700 77
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Similarly to the Calculated Field Editor, the window contains lists of available fields, functions, and operators.
You can add these items to an expression by either double-clicking them or dragging them onto the editor
window's Expression Editor field.

Users are not limited to using only the functions from the
tree view. Any function supported by the SQL Server used
by your Epicor application can be used within an
expression. In External BAQs, functions supported in the
database server where the external BAQ is executed
should be used.

12. In this example, count the number of sales orders using the below expression:
count( OrderHed_OrderNum )

13. Now specify the FOR clause of the PIVOT statement. In this example, you define which years you want to
include the pivot table output. To begin with, in the Field column, select the Calculated_OrderYear field
you created. Recall this field returns the year on which each sales order was created.

78 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

14. Now you must evaluate this field against the values you define. In the Filter Value column, select specified
constants list.

15. Click the word specified.

16. In the Enter Value List window, create the list of custom values you want to evaluate in the FOR clause.
In this example, define the years you want to analyze.

10.2.700 79
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

17. Using the TopLevel SubQuery1, select the columns you want to include in the BAQ output.
In this example, select Customer_CustID and all fields from the constants list you created in the previous
step.

80 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

For the Display Columns, do not add fields used in the


PIVOT formula or in the FOR clause. Other columns from
the source SubQuery can be selected for display.

18. Now you can test the query. The BAQ output presents aggregated numbers of orders placed by each
customer throughout the selected years.

The resulting SQL syntax looks as follows:

10.2.700 81
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Display Fields

Use the Display Fields sheet to define the columns that display on your query, how the data is sorted within the
query, and set the display names for the columns. You can also create a special calculated field that you need
within the current BAQ and create advanced data grouping expressions.
The Display Fields sheet consists of two subsheets: Column Select and Sort Order.

Column Select

Use the Column Select sheet to define the columns that display on your query.
You can also configure the display name and format for each column, create a calculation for a selected field
and define how you want to summarize data within the BAQ.

The Display Column(s) grid changes when SubQuery in focus


is of the Union, UnionAll, Intersect or Except type.

Select Display Columns - TopLevel, CTE, InnerSubQueries

When the SubQuery in focus is of the TopLevel, CTE, or InnerSubQuery type, use the below steps to select
BAQ columns.
To select columns you want to displays in BAQ results:

1. The Available Columns list displays all the tables included within the query.

82 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. To view the columns within each table, expand the table node. In this example, expand the OrderDtl table.

3. The columns available within the OrderDtl table display. Notice each column identifies the type of data it
contains - Y/N (check box), 1.2 (numeric field), abc (character field), and so on.

4. You can click the Sort Columns Alphabetically button to display the columns in alphabetical order.
Typically, you will activate this button, as it makes the fields (columns) easier to find.

5. From the Available Columns list, select the fields you want to display. You can select multiple fields by
holding Ctrl on your keyboard while selecting fields or by holding Shift to select a range of fields.

6. Click the Right Arrow button to move the selected column(s) into the Display Column(s) list. In this
example, select multiple columns from the Available Columns list and move them into the Display Column(s)
list.

7. If you want to modify the column name, enter a value in the Label field. This field displays the default name
for a field. You can edit the display name for the current field. The name you enter displays on the column
header within BAQ results.

10.2.700 83
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. To change the field's format mask, modify the value in the Format field.
Several single character format options are available. Use these options in various combinations to display
the results in the format you want. Available single character formats:
• X - Any Character
• N - Number or Letter
• A - Letter Only
• ! - Lower Case Letter
• 9 - Number Only
• > - Suppress Zeros

Example
• X(8)
• ->>>,>>>,>>9.9999

Updatable BAQs utilize two field format definitions. The


format you define on the Display Fields > Columns
Select sheet defines how a field value displays in a
read-only mode, for example, in a grid.
For updatable BAQs, you can define a second format in
the Updatable field editor. You launch the editor using
the Advanced Column Editor Configuration button

84 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

found on the Update > General Properties sheet. This


way, you can define different formats; for example, x(10)
for display and >>,>>9.99 for editing.

9. To group query results by specific column, select the Group By check box.

When selected, this field is listed in the Group By SQL


clause as well as in the Select clause. The Group By
statement is often used in conjunction with aggregate
queries utilizing aggregate functions, such as AVG, SUM,
or COUNT.
Outside the simple grouping mechanism you can use by
selecting this check box, the advanced grouping features
are available for use by clicking the Advanced Group By
Clause button. For more information, review the
Advanced Group By Clause topic later in this section.

10. You can remove columns by highlighting them in the Display Columns list.

11. Click the Left Arrow button, or drag and drop the column name to the left pane. The column returns to
the Available Columns list.

12. You can change the order in which the columns display across the BAQ grid. To do this, select a field in the
Display Column(s) List and use the Up and Down Arrow buttons.

10.2.700 85
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Select Columns - Set Operator Type SubQueries

When the SubQuery in focus is of the Union, UnionAll, Intersect, or Except type, use the steps below to select
BAQ columns.
In BAQ Designer, SubQueries are concatenated in the sequential order, so one or more SubQueries of the Union,
UnionAll, Except, or Intercept type can go after TopLevel, or CTE SubQueries.

When one or more SubQueries are combined using the above


set operators, their fields, specified on the Display Fields >
Columns Select sheet should conform to the following rules:
• The number and the order of the columns must be the
same in all SubQueries.
• The data types must be compatible, through implicit
conversion.
• Field aliases of the result record set are taken from the first
SubQuery.

To select columns you want to displays in BAQ results:

1. In a SubQuery of the TopLevel or CTE type, define the set of Display Column(s). In this example, SubQuery1
has five columns set for display.

2. On a SubQuery that follows, set one of the Union, UnionAll, Intersect, or Except set operators. In this
example, SubQuery2 of the Union type is used.

86 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. Navigate to the Display Fields > Column Select sheet.

4. At the bottom, the information on how many fields you need to select to match the number of display
columns in SubQuery1 displays.

5. You are also informed what first column is selected for display in SubQuery1 and what format it uses.

6. From the Available Columns list, select fields that meet criteria described above.

10.2.700 87
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Use the Right Arrow button to move the fields into the Display Column(s) list.

8. The Alias field displays the field name of the current SubQuery's column.

Field aliases of the result record set are taken from the
first SubQuery.

9. Each SubQuery treats Group By independently. You can construct a BAQ where only one SubQuery
aggregates data, for example:
SELECT Field1, Count(field2)
From Table1
Group By
Group By Field1
UNION
SELECT FieldX, FieldY
FROM Table2
However, if a TopLevel or CTE SubQuery groups data by specific column, and a SubQuery of the Union,
UnionAll, Intersect, or Except type is set up to also aggregate data, the number of columns must match and
column types must be compatible in both the SubQueries. The grouping method used to aggregate BAQ
results can differ in each SubQuery. You can use simple group by in one SubQuery and an advanced grouping
method in another.
In the Display Column(s) grid, all fields, except for Group By, provide read-only information only.

10. The DataType field displays the type of data of the current SubQuery's column.

88 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

11. The Subquery Set Data Type displays the expected data type of the corresponding field from the group's
uppermost SubQuery, which is either the CTE or the TopLevel type.

12. When the expected data type is different from the selected one, the error indicator displays in the
corresponding Subquery Set Data Type column.

13. The Subquery Set Alias field displays the field name of the corresponding field from the uppermost
SubQuery.
In the resulting record set, field aliases are taken from the group's uppermost SubQuery, for example:
CTE Subquery 1
UNION ALL Subquery 2 <-- fields are from Subquery 1
TopLevel Subquery3 <-- new group of Subqueries
INTERSECT Subquery 4 <-- fields are from Subquery 3
In the example above, result fields are taken from Subquery3 – TopLevel Subquery.

14. The Expected Fields box at the bottom displays the following information:

Condition Information
If the number of selected columns in the current The field shows the first NEXT field from the group's
SubQuery is Less than the number of selected uppermost SubQuery, which is expected to be added.
columns in the group's uppermost SubQuery.
Also, the information on how many fields are still to be
added displays.

If the number of selected columns in the current The information on how many fields should be removed
SubQuery Exceeds the number of selected displays.
columns in the group's uppermost SubQuery.
If the number of column in both SubQueries The Check type compatibility message displays.
Equals, and Any Type difference between
When SubQuery fields have different types, the error sign
columns occurs.
displays in the Subquery Set Data Type column.
The error sign does not automatically mean the SubQuery
fails as proper conversion can still be potentially done by
the database server. The intention of the error sign is to
inform the user about the potential data type discrepancy.

When the number of columns Equals in both The Subqueries have equal number of fields message
the SubQueries, and No Type difference is displays.
found.

15. When the BAQ designer logic encounters any errors, they also display in the Analyze Message window.

10.2.700 89
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

16. In this example, the column mapping of SubQuery2 should look as follows.

Create a Calculated Field

Use the Calculator button to create user-defined columns based on a calculation of selected fields within the
query.
To help you create valid calculations, the Calculated Field Editor contains lists of fields, functions, and operators.
These default items display in the Tree View where you can navigate and find the item you need. To add an item
to calculation, either double-click it or drag and drop the selected item to the Editor pane.
To create a calculated field:

90 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

1. Navigate to the Display Fields > Column Select sheet and click the Calculation (the calculator icon)
button.

2. In the Calculated Field Editor, click New.


In this example, you want to create a BAQ that calculates orders by customer.

10.2.700 91
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. In the Field Name field, enter the name of the field for which you create the calculation. In this example,
enter OrderCount.

You can create calculated fields having the same name


across all BAQ SubQueries. However, you cannot create
two identical calculated fields within a SubQuery.

4. From the Data Type list, select the data type generated by this calculation.
In this example, select int.

5. The Format field automatically displays the data format for this calculated field. In this example, ->>,>>>,>>9.
If you need, you can change this value.

Refer to the Business Activity Query – Calculated


Fields topic in the application help for a complete list of
the format options available.

6. Enter the Label you want to display above this calculated field’s column header in the BAQ grid. In this
example, enter Total.

7. Now you can start building the calculation logic in the Editor pane.

Be sure to use the appropriate SQL syntax within the Editor


pane.

92 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

The Editor supports intelligent code editing, which includes invoking member lists. To invoke a list of
columns for a table, enter the name of the table followed by a dot (.) and press Ctrl + Space. Select the
column you need, it will be added to the table name. For example, ABCCode.Company.

8. Use the tree view to find and select the Functions, Operators, and BAQ Constants you will use in the
current calculated field. A function calculates a value through specified parameters. An operator is a
mathematical expression used to evaluate a function. BAQ operators and functions are consistent with SQL
naming methodology.

A complete list of available Functions, Operators, and BAQ


Constants is discussed later in this chapter.

9. First navigate to the function or operator you need. Now either double-click or drag and drop it onto your
calculation within the Editor field. In this example, use the Count function.

10. Use the Fields Tree View to place a specific field within the calculation.
You can use the Fields Tree View to:
• Select any of the current Display Fields and existing Calculated fields you want to add to the calculation.
• Pull in any fields contained within the Available tables included with the current query.
• If you have created parameters to use with the BAQ, these options display under the Parameters node.
Parameters pull in multiple values that you can then use within your calculation. Be aware that parameters
using the Skip condition if empty property cannot be used to create a calculated field and do not
display on the list of available parameters. For information about creating parameters, review the The
Query Builder > SubQuery Criteria > Specified parameter topic.
In this example, expand the OrderHed table and double-click the OrderHed.OrderNum field. The field is
added to your calculation.

10.2.700 93
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. If you need, use the Calculator keys to manually refine your expression.

12. When you complete the calculation, click Check Syntax to verify the calculation logic is valid.

13. Click Save to complete the calculation.


This field now uses this calculation when you run the query.
If you have created the Inner or CTE type of Subqueries, you can also use them to build a calculated
field. For example, create a simple query and add a new inner SubQuery with only one display field
returning a single value; e.g., Select count(id) from table. You can then use the subquery to create a
calculated expression, such as {SubqueryN} + 1.

14. Click Close to exit the Calculated Field Editor window.

15. Your calculated field is now added to the list of Display Column(s).

16. You can use the Up and Down Arrow buttons to reposition the calculated field as necessary.

Example One

Several calculated fields have been created by Epicor for use in the system queries. The first example is a calculated
field called OpenQty that is used in the zSVSalesOrderBacklog query.
This calculated field determines the Open Quantity of a sales order release by taking the Requested Quantity for
a sales order release, and subtracting the Job Shipped Quantity and the Stock Shipped Quantity. The field is
formatted as a number and displayed as a decimal.

94 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Example Two

The second example is a calculated field called OpenValue that is also used in the zSVSalesOrderBacklog query.
This calculation determines the value of the remaining open balance on a sales order. The calculation uses If,
Then, Else logic written in C# based on the Price Per Code on the Order Detail table. Three different Price Per
Code values are tested in the calculation: M (price per thousand) and C (price per hundred).
The field is formatted as a number and displayed as a decimal.

10.2.700 95
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Functions

The following tables display the functions you can use within the Calculated Field Editor.

Users are not limited to the functions from the Tree View. Any
function supported by the SQL Server used by your Epicor
application can be used within an expression.
For External BAQ functionality, functions supported in the
database server where the external BAQ is executed should be
used.

Aggregate
Aggregate functions perform a calculation on a set of values and return a single value. Aggregate functions are
frequently used with the GROUP BY clause of the SELECT statement.

Function Description

Avg(x) avg(expression)
Calculates the average of all values within the numeric database field.

Count(x) count(expression)
Counts the number of times the database field was counted.

Max(x) max(expression)
Calculates the maximum of all of the values of the numeric database field.

96 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Function Description

Min(x) min(expression)
Calculates the minimum of all of the values of the numeric database field.

Sum(x) sum(expression)
Calculates the total of all the values of the numeric database field.

Math
Mathematical functions execute mathematical operations usually based on input values that are provided as
arguments, and return a numeric value as the result of the operation.

Function Description

Abs(x) abs(expression)
Returns the absolute value of a numeric expression.

Sqrt(x) sqrt(expression)
Returns the square root value of a decimal expression.

Power(x, y) power(expression. exponent)


Returns the expression raised to the power of a decimal expression.

Log(x) Log(expression)
Calculates the natural (e) logarithm of a decimal expression.

Log10(x) Log10(expression)
Calculates the base-10 logarithm of a decimal expression.

(x modulo y) (top expression % bottom expression)


Returns the remainder of the top decimal expression divided by the bottom decimal
expression.

Round(x, y) round(expression , precision )


Rounds a decimal expression to a specified number of places after the decimal
point.

Truncate(x, y) round (expression, precision, 1)


Truncates a decimal expression to a specified number of decimal places, returning
a decimal value.

String
String functions manipulate a string or query information about a string.

10.2.700 97
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Function Description

Asc(x) Asc(expression)
Converts a character expression representing a single character into the
corresponding ASCII value, returned as an integer.

Char(x) Char(expression)
Converts an ASCII integer code to its corresponding character value.

Len(x) Len(expression)
Returns the number of characters in an expression

Left-Trim(x) ltrim(expression)
Removes leading white space from a string expression.

Trim(x) ltrim(rtrim(expression))
Removes leading and trailing white space from a string expression.

Right-Trim(x) trim(expression)
Removes trailing white space from a string expression.

Substitute(x[, y, ...]) Substitute(base-string [, arg ] ...)


Returns a character string that is made up of a base string plus the substitution of
arguments in the string. An argument is referenced in string by &num identifier
where num is 1-based argument index in argument list.

Substring(x,y,z) substring(expression ,position ,length)


Extracts a portion from a string expression.

Replace(x,y,z) Replace(expression ,search ,replace)


Performs a search and replace function on a string expression.

Upper(x) upper(expression)
Converts any lowercase characters in a string expression to upper-case characters.

lower(x) lower(expression )
Converts any upper-case characters in a string expression to lowercase characters.

Date
There are a number of date functions available in the Epicor ERP application.

Function Description

Date(year, month, day) convert(date, expression, 112)


Converts a string expression in 'yyyymmdd' format into date value.

98 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Function Description

Year(x) datepart(year, expression)


Evaluates a date expression and returns the year value of that date, including the
century, as an integer value.

Month(x) datepart(month, expression)


Evaluates a date expression and returns a month integer value from 1 to 12.

Day(x) datepart(day, expression)


Evaluates a date expression and returns a day of the month as an integer value from
1 to 31.

WeekDay(x) datepart(weekday, expression)


Evaluates a date expression and returns the day of the week as an integer value from
1 (Sunday) to 7 (Saturday) for that date.

Add-interval(x,y,z) dateadd(interval-unit, interval-amount, expression)


Adds a date interval to, or subtracts a date interval from, specified expression.
Expression should be of date type.
To subtract, enter interval-amount as a negative value.
Interval-unit is one of the following words: year, month, week, day.

Conversion
Conversion functions transform an expression of one data type to another.

Function Description

DateToString(x) convert(varchar, expression, date-format-index)


Converts a date value into a character value using a date format index. Default
101 results in 'mm/dd/yyyy' string.

TimeToString(x) convert(varchar, expression, time-format-index)


Converts an integer value into a character value using a time format index. Default
108 results 'hh:mi:ss' string.

DecimalToString(x) convert(varchar, expression)


Converts a decimal value into a character value.

IntToString(x) convert(varchar, expression)


Converts an integer value into a character value.

Integer(x) convert(int, expression)


Converts an expression of any data type to a value of integer data type.

Decimal(x) convert(decimal, expression)

10.2.700 99
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Function Description
Converts an expression of any data type to a decimal value.

Date(mm,dd,yyyy) convert(datetime, convert(char, _year_*10000 + _month_*100 + _day_), 112)


Converts a set of month, day, and year values into a date value. Replace _year_,
_month_ and _day_ placeholders with references to fields of integer type or constant
values.

StringToDate("x") convert(date, expression, date-format-index)


Converts a string date representation (expression) into a date value based on date
format index. For example, if the input string contains a date like '07/21/2012',
then date format index should be set to 101.

IntToDateTime(x) convert(datetime, expression)


Converts an integer expression, into a date value. The expression is treated as
number of days after 01/01/1900.

Logical(x) convert(tinyint, expression)


Converts any data type into the logical data type.

Ranges
Functions in this category return the position, string entry, or number of elements from the list, based on the
expression.

Function Description
Lookup(x,y)
[Ice].lookup(expression, list)
Returns an integer value giving the position of an expression in a list. Returns a 0
if the expression is not in the list.

Lookup(x,y,z)
[Ice].lookup(expression, list, separator )
Returns an integer value giving the position of an expression in a list. Returns a 0
if the expression is not in the list.

Entry(x,y)
[Ice].entry(expression, list, ',')
Returns a character string entry from a list based on an integer position.

Entry(x,y,z)
[Ice].entry(expression, list, separator )
Returns a character string entry from a list based on an integer position.

Num-entries(x)
[Ice].num_entries(list)
Returns the number of elements in a list of character strings as an integer value.

Num-entries(x,y)
[Ice].num_entries(list, separator)
Returns the number of elements in a list of character strings as an integer value.

100 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Financial
Functions in this category return either the fiscal year or fiscal period for the supplied date based on the fiscal
calendar.

Function Description
FiscalYear(x)
FiscalYear(company, date)
Returns fiscal year for passed date according to fiscal calendar in the database.

FiscalPeriod(x)
FiscalPeriod(company, date)
Returns fiscal period for passed date according to fiscal calendar records in the
database.

Operators

An operator is a mathematical expression either used with a single function or used to process two or more
functions.

Section Tree View Editor View Expression


Arithmetic Add (x + y) (+) Addition operator.
Adds two numeric expressions. Adds days to date
(date + days).

Arithmetic Divide (x / y ) (/) Division operator.


Divides one numeric expression by another numeric
expression, producing a decimal result.

Arithmetic Modulo (x modulo y) (x modulo y) Modulo operator.


Determines the remainder after division.

Arithmetic Multiply (x * y) (*) Multiplication operator.


Multiplies two numeric expressions.

Arithmetic Negate ( - x) (-) Unary negative operator.


Reverses the sign of a numeric expression.

Arithmetic Subtract (x - y) (-) Subtraction operator.


Subtracts one numeric expression from another
numeric expression.

Boolean Equal (x = y) (=) Equal operator.


Returns TRUE if two expressions are equal.

Boolean And (x and y) and And operator.


Returns TRUE if each logical expression is TRUE.

Boolean Or (x or y) or Or operator.
Returns TRUE if either of the two logical expressions
is TRUE.

10.2.700 101
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Section Tree View Editor View Expression


Boolean Not (Not x) not Not operator.
Returns TRUE if an expression is false and FALSE if an
expression is true.

Comparison Equal (x = y) = Equal operator.


Returns TRUE if two expressions are equal.

Comparison Greater Than or Equal >= Greater Than or Equal operator.


(x >= y)
Returns TRUE if the first of the two expressions is
greater than or equal to the second expression.

Comparison Greater Than (x > y) > Greater Than operator.


Returns TRUE if the first of the two expressions is
greater than the second expression.

Comparison Less Than or Equal <= Less Than or Equal operator.


(x<=y)
Returns TRUE if the first of the two expressions is less
than or equal to the second expression.

Comparison Less Than (x < y) < Less Than operator.


Returns TRUE if the first of the two expressions is less
than the second expression.

Comparison Not Equal (x <> y) <> Not Equal operator.


Compares two expressions and returns TRUE if they
are not equal.

Condition If x Then y Else z (case when If-Then-Else condition.


then else end)
Evaluates and returns one of the two expressions,
depending on the value of a specified condition.

Condition Case x When y Then case Evaluates a list of conditions and returns one of
z Else k end multiple possible result expressions.
when then
when then
else
end

Other Comment /* */ Comment characters.


Allows adding explanatory text to a procedure
between the /* and */ characters.

Other Begins Begins Begins operator.


Tests a character expression to see if that expression
begins with a second character expression.

Other Matches “* *” Matches operator.


Compares a character expression to a pattern and
evaluates to TRUE if the expression satisfies the pattern
criteria.

102 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

BAQ Constants

The following table displays the BAQ constants you can use within the Calculated Field Editor.

Anytime the server code resolves Today or Now the method


returns the value based on the company time zone setting. If
not set, it will use the app server time zone.

When a BAQ is executed, Today and other dependent


constants, as well as the current date value for current
date-based condition, are calculated one time per query run,
and their values are based on company time zone of the
company from which the BAQ is executed. For Cross-Company
BAQ, it means the value of Today and dependent constants is
calculated based on company time zone of user’s current
company; it is not recalculated for each company from which
the data is retrieved by Cross-Company BAQ.

BAQ Constant Description


CompanyName The Company Name of the company the user is logged into.
CountryCode The Country Code of the company the user is logged into.
CountryGroupCode The Country of Origin Code of the company the user is logged into.
CurComp The Company ID of the company the user is logged into.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the CurrentCompany
constant.

CurCompName The Company Name of the company the user is logged into.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the
CurrentCompanyName
constant.

10.2.700 103
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

BAQ Constant Description


CurLangID The language ID of the language being used in the Main Menu of the current
session.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the CurrentLanguageID
constant.

CurrentCompany The Company ID of the company the user is logged into.


CurrentCompanyName The Company Name of the company the user is logged into.
CurrentEmployeeID The Employee ID linked to the user of the current session.
CurrentLanguageID The language ID of the language being used in the Main Menu of the current
session.
CurrentPlant The Plant ID of the company the user is logged into.
CurrentTime The current system time. Returns seconds elapsed since midnight.
CurrentUserID The User ID of the user of the current session.
Day The day of month of the Current Date.
DayOfWeek Returns the current day number of the current week.
DefUM The default Unit of Measure of the current site.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the DefaultUM
constant.

DefaultUM The default Unit of Measure of the current site.


DesignMode Indicates the special developer mode for Epicor developers is used.
EmployeeID The employee id linked to the user of the current session.
FirstDayOfMonth The first day of the current month of the Current Date.
FirstDayOfNextMonth The first day of the next month of the Current Date.
FirstDayOfNextWeek The first day of the next week of the Current Date.
FirstDayOfPrevMonth The first day of the previous month of the Current Date.
FirstDayOfPrevWeek The first day of the previous week of the Current Date.
FirstDayOfWeek The first day of this week of the Current Date.

104 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

BAQ Constant Description


GlobalSecurityManager The current session user is a Global Company Security Manager.
LanguageID The language ID of the language being used in the Main Menu of the current
session.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the CurrentLanguageID
constant.

LastDayOfMonth The last day of the month of the Current Date.


LastDayOfNextMonth The last day of the next month of the Current Date.
LastDayOfNextWeek The last day of the next week of the Current Date.
LastDayOfPrevMonth The last day of the previous month of the Current Date.
LastDayOfPrevWeek The last day of the previous week of the Current Date.
LastDayOfWeek The last day of the current week of the Current Date.
MobileConnect Indicates the Mobile Connect mode is running.
Month The current month of the Current Date.
PlantID The Plant ID of the company the user is logged into.

This constant is used for


compatibility with queries
written in Epicor 9 after
they were migrated or
imported into Epicor ERP
Version 10.
When building a new BAQ,
use the CurrentPlantID
constant.

ProductCode The application product code. The available options include "EX" for Express,
"ST" for Standard, "EN" for Enterprise and "Epicor" for any other product
line.
ProductName The application product name. The available options include Express, Standard,
Enterprise and Epicor.
SecurityManager The current session user is a Security Manager.
Today The Current Date.
Tomorrow The next day after the Current Date.
VersionString Displays the ICE framework assemblies version of the current product. For
example, 3.0.5.0.
Week The current week of the Current Date.

10.2.700 105
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

BAQ Constant Description


WorkstationDescription The description of the Workstation ID specified in Workstation Maintenance.
WorkstationID The ID of the workstation specified in Workstation Maintenance.
Year The current year of the Current Date.
Yesterday The previous day of the Current Date.

Field Attributes Editor

Use the Display Field Attributes Editor to add, edit or remove attributes of the fields that display on your
query.
Each DB field has a set of properties such as format or label. Using the Display Field Attributes Editor, you can
modify the existing properties and create custom ones for the current BAQ. When the BAQ runs, it uses the
field attributes you define.
To access the Editor, on the Display Fields > Column Select sheet, click the Field Attributes Editor button.
In the Editor window, all columns you selected for display are presented in the Tree View on the left. When you
select a field, the grid displays all attributes for that field. These can be:
• Default attributes specified in the system. You can accept the default state or modify these attributes as
needed.
• Custom field attributes you define for the query.

The default attributes do not display for:


• Calculated Fields
• Fields from Inner SubQueries
• External BAQs

Modify Field Properties

This example demonstrates how you can use the Display Field Attributes Editor to modify field properties.

1. First, on the Display Fields > Column Select sheet, identify columns you want to display on the BAQ.

106 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Notice there are two field properties you can modify directly on the Column Select grid - Label and Format.
In this example, accept the default values on this grid.

3. Click the Field Attributes Editor button.

4. In the Editor, all the columns you selected for display in the Tree View.

10.2.700 107
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. In the grid, default (system) attributes of the currently selected field display. The attributes in the default
state are grayed out and cannot be removed from the grid.

The default attributes do not display for:


• Calculated Fields
• Fields from Inner SubQueries
• External BAQs

6. In this example, you override the default Caption and Format properties by modifying the corresponding
entries in Value column. Notice after property is changed, the corresponding Override check box becomes
selected, indicating the default value has changed for the current BAQ.

108 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

If you need to revert the attribute to its original state, you delete the overridden attribute and exit the
Editor window. When you launch the Editor again, the attribute is again set to its original state and the
corresponding check box becomes clear again.

7. Apart from modifying default field attributes, you can create custom ones. To do so, click New.

10.2.700 109
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. The new Attribute record is created. From the list, you can select one of the predefined attribute types, or,
you can enter the name of your choice.
Custom attribute names are not case sensitive. Be sure to enter unique names when defining custom
attributes for a SubQuery. Attributes are specific to each table and SubQuery. For example, if your BAQ is
made of two SubQueries referencing the same DB table, different field attributes can be specified for each
SubQuery.
For more info on the list of predefined attributes, review the Extended Property Maintenance topics within
the Application Help.

9. In this example, you create a custom attribute for a user-defined field. Similarly, you can create another
custom attributes you need to use within the current BAQ.

110 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. Click Save.

Be aware you can no longer change the custom attribute's


name after you save it. If you need to use another name
for your attribute, delete the record and recreate it.

11. Exit the Editor. Notice the Label (Caption) and Format properties you modified for the Customer ID column
display on the grid.

10.2.700 111
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Advanced Group By Clause Editor

Use the Advanced Group By Clause Editor to build advanced data summarizing expressions.
In BAQ Designer, you can use the following data grouping options:
• Simple Group By mechanism - You can group the query results by specific column(s) by selecting the Group
By check box on the Column Select sheet. This feature, however, has a few limitations - it is only available
for fields selected as Display columns and within the resulting Group By clause, these fields always appear in
the same order as in the Select statement.
• Advanced Summarizing Options - By accessing the Advanced Group By Clause Editor, you can create more
complex summarizing expressions, such as:
• Group BAQ results by fields different from those defined in the SELECT statement.
• Define custom order of columns in a GROUP BY clause.
• Use special GROUP BY operators, such as ROLLUP, CUBE, and GROUPING SETS. These operators are
extensions of the GROUP BY clause. They can generate the same result set as when you use UNION ALL
to combine single grouping queries; however, using one of the GROUP BY operators is usually more
efficient.

Create Group By Expression

112 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

In this example, assume you want to analyze on hand-quantities of specific parts located within several warehouses.
Learn how to use the available Group By operators to get the expected results.

1. Create a new BAQ and place the PartBin table on the canvas.

2. In this example, a filter on the table is applied to only retrieve records for parts 1032x073 and 1032KNUT.

3. For the Display Column(s), select the PartBin_WarehouseCode and PartBin__PartNum columns.

10.2.700 113
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. Also, create a calculated field that summarizes on-hand quantities of selected parts.
Use the following calculation:
sum( PartBin.OnhandQty )

5. Now access the Advanced Group By Clause Editor by clicking the button.
Similar to the Calculated Field Editor, the window contains lists of available fields, functions, and operators.
You can add these items to an expression by either double-clicking them or dragging and dropping them
onto the editor window's Expression Editor field.
For the complete list of predefined functions, operators, and BAQ constants, see the Application Help topics.

6. Click Add Row to create a new expression.

114 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. At the top of the Functions node, notice the Group By category displays.
The ROLLUP, CUBE, and GROUPING SETS operators found in this category represent advanced aggregation
extensions of the GROUP BY clause.

Function Description
ROLLUP
The ROLLUP operator is useful in generating reports that contain subtotals and totals. It
generates a result set that shows aggregates for a hierarchy of values in the selected
columns.
As a result, one row with a subtotal is generated for each unique combination of values
of (a, b, c) , (a, b) , and (a). A grand total row is also calculated.

CUBE
Generates simple GROUP BY aggregate rows, the ROLLUP super-aggregate rows, and
cross-tabulation rows. CUBE outputs a grouping for all permutations of expressions in the
<composite element list>.
As a result, one row is produced for each unique combination of values of (a, b, c) , (a,
b) , (a, c) , (b, c) , (a), (b), and (c) with a subtotal for each row and a grand total row.
GROUPING
Specifies multiple groupings of data in one query. Only the specified groups are aggregated
SETS
instead of the full set of aggregations that are generated by CUBE or ROLLUP. The results
are the equivalent of UNION ALL of the specified groups. GROUPING SETS can contain a
single element or a list of elements. GROUPING SETS can specify groupings equivalent to
those returned by ROLLUP or CUBE. The <grouping set item list> can contain ROLLUP or
CUBE.

For more information on the above operators, review the available Microsoft® documentation, for example:
• http://technet.microsoft.com/en-us/library/bb522495(v=sql.105).aspx
• http://technet.microsoft.com/en-us/library/ms177673.aspx
• http://blogs.msdn.com/b/craigfr/archive/2007/10/11/grouping-sets-in-sql-server-2008.aspx

10.2.700 115
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. In this example, double-click the ROLLUP function. Place you cursor in the middle of empty brackets. For
Group By expression fields, double-click both the PartBin.WarehouseCode and PartBin.PartNum fields,
separated by a comma.
The Group By expression should now read:
ROLLUP( PartBin.WarehouseCode, PartBin.PartNum )

9. Click OK to exit the editor.

10. Click the Test button to retrieve the BAQ results.

11. Notice the total values are summarized by each warehouse and part (aggregate rows), sub-totals rows for
each warehouse with the grand total value displaying at the bottom.

12. Notice how BAQ results change when GROUPPING SETS function is used to construct the GROUP BY clause.
GROUPING SETS( PartBin.WarehouseCode, PartBin.PartNum )

116 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

BAQ results are now grouped by sets of parts and warehouses.

13. Notice how BAQ results change when CUBE function is used to construct the GROUP BY clause.
CUBE( PartBin.WarehouseCode, PartBin.PartNum )

10.2.700 117
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

CUBE outputs a grouping for all permutations of expressions in the composite element list.
The Advanced Data Aggregation case study found at the end of this chapter shows more complex
scenario on how to aggregate results from multiple tables.

Sort Order

The Sort Order sheet is where you define how the data results display when the query runs. You can sort your
data through any combination of columns. You can also select whether the data displays in ascending or
descending order.

You can only add sort fields for the main query or for the
SubQueries using the TOP clause. Otherwise, the BAQ fails on
execution.

1. In the Available Columns section, highlight the column by which you want to sort data.
You can also use keyboard combinations to select multiple fields. You can click one field and then press
and hold the Shift key to select a range of fields. You can also press and hold the Ctrl key and select a
specific group of fields.

The data in this query is now sorted first by Company, then by Sales Order Number, and lastly by Sales Order
Line Number.

118 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the Right Arrow button or drag and drop the column names to the right pane.
The columns are added to the Sort By field.

3. If you need, use the Up and Down Arrow buttons to change the sorting order.

10.2.700 119
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. To control if data should be sorted in ascending or descending order, double-click the selected column. The
direction is reflected on the small triangle that displays next to the selected column.

5. To remove a column from the sort list, highlight it and click the Left Arrow button.

6. Once finished, click Save.

7. When the BAQ executes, the results are sorted.

120 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

SubQuery Options

Use the SubQuery Options sheet to define subquery parameters.


A subquery is a query that is nested inside the SELECT statement, or inside another subquery. A subquery can
be used anywhere an expression is allowed. Each Business Activity Query can contain one main subquery, where
Type=TopLevel, and several subqueries of different types to indicate how they correlate with each other.
Subqueries give different advantages for query design, including:
• Support of widely used query criteria, such as IN ({inner subquery}) or EXISTS ({inner subquery})
• Using common table expressions (CTE), including CTE with recursion and UNION ALL, for querying hierarchical
data
• Using CTE and inner subquery in the FROM clause and joins
• Using set operations, like UNION, UNION ALL, EXCEPT, and INTERCEPT

The above set operators are the methods of combining


several result sets. You can create one TopLevel subquery
and combine its result with some other subqueries of this
subquery type, using these SQL standard keywords.

By default, a simple query contains only one subquery with the following attributes:

Field Value
Name SubQuery1
Type TopLevel
Results Row Set All

When you add new subqueries to the BAQ, all subqueries, excluding Inner subqueries, are ordered by the Seq
field. Each query text is generated and these texts are concatenated. No assumption of the subquery order is
made.

10.2.700 121
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Define Main SubQuery

When you create a new BAQ, the main subquery named SubQuery1 is created by default.
To set up the main subquery:

1. Create a new query and specify its main parameters on the General sheet.

2. Navigate to the Query Builder > SubQuery Options sheet.

3. In the Name field, enter the name of the main subquery. In this example, the BAQ returns the list of quotes
from the QuoteHed table. To identify the subquery, you can enter this value in this field.

4. In the Type field, verify TopLevel displays.

Each BAQ can contain only one main TopLevel subquery.

5. In the Result Set Rows field, select how data displays in the subquery results set.
The table below lists the available options:

Keyword Description
All Default value; the SELECT ALL returns all data without restriction.
Distinct SELECT DISTINCT specifies that only unique rows can display in the result set.

122 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Keyword Description
Top SELECT TOP specifies the number of rows or percent of rows to return.
You can specify either the number or percent of rows the result set displays.
WITH TIES specifies that the query result set includes any additional rows that match
the values in the ORDER BY column or columns in the last row returned. This may
cause more rows to be returned. TOP...WITH TIES can be specified only in SELECT
statements, and only if the ORDER BY clause is specified.

DistinctTop SELECT DISTINCT TOP corresponds to using DISTINCT and TOP clauses simultaneously.
The query results set contains top unique rows.

6. When the Top or DistinctTop keyword is selected in the Result Set Rows field, the Top Clause pane becomes
enabled. Also notice the Order By OFFSET - FETCH Clause pane is now disabled.

TOP as well as DISTINCT TOP cannot be combined with


OFFSET and FETCH in the same query expression.

7. In the Rows Number field, enter the number of rows or percent the query results set should return. You
can, for example, have the query return the list of 50 latest quotes for a review.

8. If you select In Percent, the top percent of rows specified in the Rows Number field is returned in the results
set.

9. If you select With Ties, the query result set includes any additional rows that match the values in the ORDER
BY column or columns in the last row returned.

Only select this option in SELECT statements and only if


the ORDER BY clause is specified.

10. The Offset and Fetch fields provide you with an option to fetch only a window or page of results from the
result set. You can use the Offset field to enter the number of rows to skip, before starting to return rows
from the query expression.

10.2.700 123
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. The value you enter in the Fetch field specifies the number of rows to return after processing the OFFSET
clause.

The OFFSET/FETCH rowcount expression can be any


arithmetic, constant, or parameter expression that returns
an integer value.

The following limitations exist:


• Using OFFSET/FETCH requires MS SQL Server 2012 or later.
• ORDER BY is mandatory to use the OFFSET and FETCH clause.
• OFFSET is mandatory with FETCH. You can never use ORDER BY … FETCH.
• OFFSET and FETCH cannot be combined with TOP/DISTINCT TOP in the same query expression.

Example You can construct a BAQ against the table of


all employees. By entering 5 in the Offset field, the first
five rows from the sorted result set are skipped. By
entering 10 in the Fetch field, the BAQ returns next 10
rows from the employees table. The resulting query syntax
looks as follows:

select
[EmpBasic].[EmpID] as [EmpBasic_EmpID],
[EmpBasic].[FirstName] as [EmpBasic_FirstName],
[EmpBasic].[LastName] as [EmpBasic_LastName]
from Erp.EmpBasic as EmpBasic
order by EmpBasic.EmpID OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY

Create SubQuery

When you construct a query, you can add various types of subqueries and indicate how they correlate with each
other.
To define a subquery:

124 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

1. Navigate to the Query Builder > SubQuery Options sheet.

2. On the Active SubQuery toolbar, click New SubQuery.

3. In the Name field, enter the subquery name.


This subquery retrieves the list of orders from the OrderHed table. To identify the subquery, you can enter
this value in this field.

4. In the Type field, select the type of correlation between subqueries. By default, the subquery is set to the
InnerSubQuery type. In this example, combine the current subquery's results with the TopLevel subquery
using the Union operator.
The table below lists all available options you can use for the subquery:

Type Description
TopLevel Default value for a simple query; each BAQ can contain one main TopLevel subquery.
Union Selects related information from two tables, much like JOIN. However, when using
UNION, all selected columns need to be of the same data type. With UNION, only distinct
values are selected.
UnionAll Equal to UNION, except that UNION ALL selects all values.
The difference between UNION and UNION ALL is that UNION ALL does not eliminate
duplicate rows; instead it just pulls all rows from all tables fitting your query specifics
and combines them into a table.

10.2.700 125
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Type Description
Intersect Returns the results of two or more selected queries. However, it only returns the rows
selected by all queries. If a record exists in one query and not in the other, it is omitted
from the results.
Except Returns any distinct values from the query to the left of the EXCEPT operand that are
not also returned from the right query.
CTE A common table expression (CTE) can be thought of as a temporary result set defined
within the execution scope of a single SELECT (or may serve as a subquery, instead of
SELECT).
Common use of CTE is to query hierarchical data. Returning hierarchical data is common
use of recursive queries, for example: displaying employees in an organizational chart,
or data in a bill of materials scenario in which a parent product has one or more
components and those components may, in turn, have subcomponents or may be
components of other parents.

InnerSubQuery Usually added to the WHERE clause of the SQL statement as a nested query inside another
query. Most of the time, a subquery is used when you know how to search for a value
using the SELECT statement but do not know the exact value.

When connecting subqueries using UNION, UNION ALL,


EXCEPT, and INTERSECT, it is necessary to define the same
number and type of display fields in both the subqueries.
Field labels may be different. If this condition is not met,
the BAQ fails on execution. For more information, review
the Select Columns - Set Operator Type SubQueries
topic discussed before.

5. In the Result Set Rows field, select how data displays in the subquery results set.
For more information on the Type and Result Set Rows options, review the previous Define Main SubQuery
topic.

6. Navigate to the Query Builder > Phrase Build sheet.

126 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. Add table(s) you need to construct the subquery. Use the techniques defined in the Phrase Build topics to
create the BAQ.

Example You can, for example, create links between


tables and subqueries, use various operators, reference
subqueries when filtering data or creating calculated fields,
and so on.

8. To switch between subqueries, use the Active SubQuery navigational toolbar.

9. When complete, click Save.

10. On the General sheet, in the Query Phrase section, view the resulting SQL statement.

11. In this example, notice the TopLevel subquery displays at the top of the SQL statement, followed by the
second subquery of the Union type.

10.2.700 127
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. Navigate to the Analyze sheet and verify the syntax is OK and the BAQ returns expected data.

The Case Studies section at the end of the chapter


provides several step-by-step examples on how to create
BAQs with multiple SubQueries.

128 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Move Item(s) to SubQuery


When designing a BAQ, you can transfer tables and SubQueries placed on the designer canvas between SubQueries.
You can either move the selected item(s) to another SubQuery or create a new one.

1. On the Query Builder > Phrase Build sheet designer canvas, select item(s) you want to move to another
SubQuery.
To select multiple items, hold Ctrl and select items of your choice.

You can move tables that have relations between them.


However, the move operation is not supported when
relations are defined between selected and unselected
items.

10.2.700 129
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Right-click any of the selected items to open the context menu and select Move to SubQuery.

3. On the Move Item(s) To SubQuery window, you can do the following:

a. Move the selected item(s) to another SubQuery (other than current).


To do so, select the Move To Existing SubQuery option and highlight the SubQuery where you want
to move the selected item(s).

b. Move the selected item(s) to a new SubQuery.


To do so, select the Create New SubQuery option and enter the following information:
• In the Name field, accept the default SubQuery name or enter the name of your choice.
• From the Type drop-down list, select what type of SubQuery you want to create. The default option
is InnerSubQuery.

130 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

4. Click OK.
The BAQ Designer switches to the SubQuery you selected. The tables and SubQueries you selected for
transfer display on the canvas, including their relations.

The move operation changes the SubQuery identifier for


all tables, relations and relation fields, selected fields, sort
fields, criteria fields and function call parameters.
However, this process does not parse any expressions like
Calculated fields, advanced GroupBy expressions or
expressions on the right side of criteria. If this is the case,
manual adjustment could be required after the move
operation is performed.

SubQuery List

Use the SubQuery List sheet to view and manage all subqueries you create within the BAQ.
In the grid, all subqueries you create are ordered by the sequence number. Except inner subqueries, the sequence
number defines how partial query texts are concatenated to build the final SQL statement. If a subquery contains
reference to an inner subquery, the text of the inner subquery is generated on demand and inserted where
required.
On the subquery panel, you have the ability to create and remove subqueries, change their sequence value, and
view how data displays in the results set.
To manage subqueries:

1. Navigate to the Query Builder > SubQuery List sheet.

The parameters of subqueries in the grid display in the


read-only mode. For more information on each of these
fields, review the SubQuery Options topic.

2. To create a new subquery, click the New SubQuery button. You must then define its main parameters on
the SubQuery Options list.

3. To remove the subquery from the BAQ, click Remove SubQuery.

10.2.700 131
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. To move the selected subquery up in the list, click the Up Arrow button.

5. To move the selected subquery down in the list, click the Down Arrow button.

6. You can use parentheses to group SubQueries and create the following query constructions:
• Addition of Union SubQueries to InnerSubQueries.
• Grouping of Set-Operator SubQueries.
Note when a group for an inner SubQuery is created, the field mapping is shown using this first inner
SubQuery:
Top
Inner <- some separate inner SubQuery
Union <- fields are selected according to the Top field list
Top
(Inner <- groups with next Union
Union)<- Fields correspond to Inner SubQuery

7. Once finished, click Save to refresh the BAQ definition.

Updatable Business Activity Query

Besides using BAQs to display custom views of data, you can also create updatable business activity queries.
These updatable queries have business object methods connected to them, so users can create and edit records
- updating the database through the query itself.
You create updatable BAQs in a similar way to display only BAQs by adding tables, filter criteria, display columns,
and so on. You have some extra steps, however, as you need to define which table contains the updatable fields
and also make sure the business object methods are correctly linked to the updatable fields.
Just like a read-only BAQ, you can link as many tables in relationships as you need. Multiple tables accessed by
each BAQ can be updatable, however, so you can construct updatable BAQs that contain as many updatable
fields as you need. The one limitation is that only one business object involved in each process can contain an
updatable BAQ, but because multiple updatable table combinations are possible, you should be able to create
an updatable BAQ that matches your needs.
Epicor ERP supports connection to the read-only copy of the database, if available, to reduce the workload on
the live database. For example, the Always On availability groups feature of the SQL server allows to configure
a primary read-write database and its several read-only replicas. If necessary, the Use Primary Database execution
setting in the BAQ Designer allows users to ensure that a particular BAQ is executed against a primary read-write
database. Updatable BAQs require assured access to the most up-to-the-second data. Therefore, Updatable BAQs
are always executed against a primary database.
If you are interested in learning more about how SQL Server can be configured to support the read-only
database capability, please refer to the Microsoft® documentation for information on the Always On availability
groups feature of the SQL Server®.

You can place updatable BAQs on smart client dashboards. After you add these dashboards to the Main Menu,
they become custom data entry programs users can launch to both review current data and make any updates
they need. Optionally, you can also use updatable BAQs on mobile device dashboards. Once you create a mobile
dashboard that contains an updatable BAQ, users run this custom entry program on an iPhone, Blackberry, or
other supported mobile device. Users enter data through the mobile device, directly updating the database

132 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

wherever they may be. To build mobile device dashboards, you must purchase a mobile device dashboard license
from Epicor.

To create updatable BAQs, you must have BAQ Advanced


User rights granted in User Account Maintenance. Users having
BPM Advanced User rights are allowed to use the entire BPM
toolset, when designing uBAQ method directive.
Be aware that Advanced BPM User rights are not available to
Epicor Cloud ERP - Multi Tenant users because free-form C#
code could be a security risk for access of data outside of the
tenancy. Most common business requirements for reading and
writing data within the tenancy restrictions can be
accomplished by using the built-in interface.
Furthermore, in order to use BPM Update Processing via
UpdateExt and Advanced BPM Processing (design,
import/export and copy), the BusinessProcessManagement
module must be licensed in your Epicor ERP installation. The
BPM license is not required for database updates through Epicor
Service Connect workflows.
For more information, contact your system administrator.

User Rights

Although you can access most BAQ functionality, to create and modify updatable BAQs, you must have both
advanced BAQ and advanced BPM rights. Because the updatable business activity queries run through BPM
methods, you need to use these advanced features. You activate advanced BAQ and BPM rights on your account
within User Account Maintenance.
To assign updatable BAQ rights to a user account:
Menu Path: System Setup > Security Maintenance > User Account Security Maintenance

1. Use the Detail sheet to find and select the user record you need.

10.2.700 133
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Navigate to the Options sheet.

134 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. Select the BPM Advanced User check box.

4. Select the BAQ Advanced User check box.

5. Click Save on the Standard toolbar.

This user account can now access the updatable BAQ features. The next time you log into the application through
this user account, you can use the Update sheets within the Business Activity Query Designer.

General Properties

Use the controls on the General Properties sheet to indicate how users can enter and edit records through the
updatable BAQ. You also indicate which fields are available for data entry.

Updatable Query Settings

Define the main options for your updatable query.


To define the main updatable BAQ properties:

1. Create a new BAQ. To activate the sheets under the Update tab, one the General sheet, select the
Updatable check box.
In this example, an updatable BAQ using the Customer table is used.

When you select this option, the Use Primary Database


option in the Execution Settings is selected automatically
and displays in read-only mode. Updatable BAQs require
assured access to the most up-to-the-second data and
therefore must always be run against a primary read-write
database. The Use Primary Database execution settings
ensures that the Epicor ERP application requests a
connection to a primary database and not a read-only
replica, when the latter is available. For example, read-only

10.2.700 135
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

copies of the primary database may be configured on SQL


servers with advanced availability settings.
If you are interested in learning more about how SQL
Server can be configured to support the read-only
database capability, please refer to the Microsoft®
documentation for information on the Always On
availability groups feature of the SQL Server®.

2. Define the main options for your updatable query. Navigate to the Update > General Properties sheet.

3. Select the Allow New Record check box to indicate users can add new records through this updatable
BAQ.
When this check box is clear, users can only update existing records.

4. If you wish, specify the Label for AddNew value. This value defines what appears on the drop-down menu
next to the New button on the Standard toolbar.
The text you enter here displays as a node on this drop-down menu. Make sure it identifies the purpose of
the new record the users create through this updatable BAQ.

5. Select the Allow Multiple Row Update check box to give users the ability to make changes to two or
more rows in a table at the same time.
If this check box is clear, users are required to save one changed row before they can work on another
row.

136 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. To make new actions available for use within an updatable BAQ directive, you need to create action
placeholders by clicking the Define Custom Actions button.

7. The Define Custom Action window displays.

8. To create a new action, click the New button.

9. Enter an ActionID. This identifier defines the custom action within the updatable BAQ.

10. Enter an ActionLabel. This value defines how the action displays on buttons within the dashboard.

11. If you wish to remove a custom action, click the Delete button.

12. Continue to add the custom actions you need. When you finish, click OK.

13. You return to the Update > General Properties sheet.

14. You can also launch the Define Custom Action window from the Actions menu. To do this, from the Actions
menu, select Define Custom Action.

10.2.700 137
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Define Updatable Fields

Use the Query Field List to indicate which Display Column fields the users can update. You can also create or
select default values that automatically populate a field.

1. The Alias field displays the specific name for each column within your updatable BAQ TopLevel SubQuery.

138 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. The Data Type field indicates the kind of data contained within the specific field. Available types:
• nvarchar - Alphanumeric characters
• int - Whole numbers only
• decimal - Numbers which also contain decimal places
• bit - Defines a True/False value; on the interface, logical fields appear as check boxes or radio buttons
• date - Date (month, day, year) values only
• datetime - A date value which also includes the time
• uniqueidentifier- A Globally Unique Identifier value
• bigint - Used when column contains numbers too large for the Integer data type

3. The Updatable column indicates which fields are allowed for data updates. You can specify which fields
you want to update through this BAQ by selecting the corresponding check boxes. You can also use the
Updatable column header check box to set multiple fields at once.

Rows marked as ReadOnly are not allowed for data


updates.

4. Use the Mandatory column to specify which BAQ fields become required. This indicates which fields cannot
be empty when you attempt to save a record to the database.
You can configure the list of mandatory fields manually, by selecting the check box for each of the fields
you need.

5. If you want set multiple fields at once, use the Mandatory column header check box. This control behaves
the same way as for the Updatable column described in step 4.

6. You cannot update a field if it's specified as ReadOnly in the source table. This check box displays for your
information and cannot be modified. If this check box is selected, users cannot change the data that appears
in this column.

7. Use the Initial Expression field to enter a text value that displays in the field before users actually enter
data in it. Use this feature to place some instructional text in the field to help the user understand what
information is required for this field.

8. If you want to create a calculation to determine the initial expression, click the Column Initial Expression
button. This launches the Updatable Field Initial Expression window; use the controls on this window
to create a formula that generates the initial expression you need for a specific field.

• This button becomes enabled when the Allow New


Record check box is selected on the General Properties
sheet, the BPM Update processing method is selected
and a BPM Update Processing Business Object is
specified on the Update Processing sheet; if any
other Processing method is selected, Column Initial
Expression selection is disabled.
• Be sure to use c# syntax when building an expression.
• To verify the expression is available for use within the
uBAQ, use the Check Syntax button. Any errors are
reported in the grid below the Editor pane.

10.2.700 139
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Note the validation process reacts on:


• Empty Expression Statement
• Syntax Error
• Security Issue (non-advanced BPM users)

The following table lists the limitations for Initial Expressions:

Allowed
• Any .net functions that return scalar value of acceptable data type can be used. For
Elements
example, you can specify this initial expression for an integer data type field like
DateTime.Now.Year.
• If you have BPM Advanced User rights you can refer to database table field values.
The expression should results in scalar value of acceptable data type. For example,
this.Db.ABCCode.First().Company.
• BAQ constants can be used.

Not Allowed
• Initial Expression is specified for the fields on the record added to query result table.
Elements
This record is current during expression execution, so reference to another query
result table record is not allowed.
• The order of field initialization is not determined, so reference to another field in a
new record is not allowed.
• The ttResult variable is not allowed in Initial Expressions. It causes errors when the
Check Syntax, BAQ Analyze, or query validation (on save) action is performed and is
not supported by auto-complete. The presence of ttResult is not verified during import
so legacy queries may be imported without any errors.
• Current row fields cannot be used. For example, you cannot specify the
ABCCode_PcntTolerance expression for the ABCCode_StockValPcnt field.
• Only single line statement is allowed, so you cannot use semicolon delimiter and
single line comments.

9. You can also define specific acceptable values that will be available in a specific field. To do this, click the
Advanced Column Editor Configuration button.
This feature is discussed in the following topic.

Updatable Field Editor

Use this window to define the type of data the users will enter through this updatable BAQ field. You can define
text fields, date fields, number fields, drop-down list options, and radio button options through the controls in
this window.
Updatable BAQs use two field format definitions. The format you specify on the Display Fields > Columns
Select sheet defines how a field value displays in the read-only mode, for example, in a grid.
You can define a second format in the Updatable field editor. This way, you can define different formats; for
example, x(10) for display and >>,>>9.99 for editing.
This window is similar to the Query Parameters window described in the previous Phrase Build - SubQuery
Criteria section.

To use the editor:

140 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

1. Use the Tree View to select an updatable field for which you want to define values.

2. Select the Data Type for the parameter from the drop-down list. Available types:
• nvarchar
• integer
• decimal
• date
• dateTime
• bit
• uniqueidentifier
• bigint

3. In the Format field, the default format for this Data Type displays.
If you need, you can edit this value. Make sure the format follows the convention of the database.

4. If this field is required in order for the BAQ to pull in query results, select the Mandatory check box.

5. Use the Editor Type drop-down list to define the editor control the user will have for entering data within
the updatable field. Available options:

Option Description
Common Editor Activates the Editor Default field. Enter a custom text value you need for the
field.
This text appears by default; users can then enter a different value in this field.

10.2.700 141
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Option Description
Radio Button Set Activates the Values Editor sheet. Use this sheet to define the various radio
button options for this field. Users can then select a radio button option from
the values you define in this window.
DropDown List Activates the Data from drop-down list. Use this list to define the source of
the drop-down list options. The field then displays options contained in the
drop-down list.

6. If you select the Common Editor option from the Editor Type drop-down list, the Editor Default field
becomes active. Enter the default value you want within this field. When you use this updatable BAQ in a
dashboard, this value is used to perform field level validation either before changes to a field are saved to
the database or after updates to the field are changed and returned for display on the interface.

7. If you want this field to generate a Business Process Management (BPM) method, select the Raise Events
check box. When you complete your updatable BAQ on the Update Processing sheet, you can see these
new methods within the Updatable BAQ Method Directives window. On the finished Dashboard assembly,
this is used to perform field level validation before proposed changes to the field are committed or to perform
additional updates after the field value changes.

8. If you want the field to have access to a quick search for finding and selecting data entry values, click the
Quick Search button to locate the quick search you need. You create quick searches through Quick Search
Maintenance; these configurable search programs display input criteria to use for a search, display search
result fields, and return the data from the specific field you define. For more information on quick searches,
review the Quick Search section within the Searches chapter.

9. If you select the DropDown List option from the Editor Type drop-down list, the Data from field becomes
active. Use the options from this drop-down list to indicate the source from which the data on this list
populates. Available options:

Option Description
Custom Values
Causes the Values Editor to display controls for creating a new list of values. Use this
functionality to define the various list options this drop-down list will use.
Enter the following information:
• Value - Enter the actual value of the parameter that will be sent to the query.
• Display Text - Enter the text displayed for the user for this value.
• Order - Defines the sequential order of items in the list.

BAQ The Values Editor displays controls for selecting a BAQ. Enter the following information:
• Query ID - search for and select the BAQ you need.
• Display Column - select the column that displays in the lookup list.
• Value Column - defines the name of the column you want to use for the field value.

User Codes Causes the Values Editor to display controls for selecting a specific User Code. User codes
are lists of custom values you define through User Defined Code Maintenance. When
you select a user code, the drop-down list populates with values contained within the
custom user code record. For more information about creating user codes, review the
User Defined Codes Maintenance help topics.

142 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. Continue creating values for all of the updatable fields you need. When you finish, click Save.

11. To exit this window, click Close.

Update Processing

In order for your updatable BAQ (uBAQ) to work properly, use the controls on the Update Processing sheet to
select and configure a processing method used to update the target database.
You can select one of the following processing types:

1. Use the Service Connect Workflow method to set up the interaction of business activity query with Epicor
Service Connect (ESC). Database updates are performed using the ESC workflow created directly from the
Business Activity Query Designer.

This method is set by default for external uBAQs.

2. Use the Advanced BPM Update only method to create a BPM directive manually from scratch, or to
customize the directive generated by BPM Update processing. Updatable BAQ directives initiate BPM actions
based on method calls launched from an updatable BAQ.

3. Use the BPM Update method to perform database updates using the special Business Object method
UpdateExt that simulates the standard way of how application manipulates data within business objects.

This method is set by default for regular (non-external)


uBAQs.

Each of these methods is discussed in the following topics.

Epicor ERP and Epicor Service Connect Interoperability

You can use Epicor ERP to cooperate with Epicor Service Connect (ESC). Once configured, you can create or
execute ESC workflows directly from within the Epicor ERP application.
Calls to Service Connect can be performed from within:
• Business Process Management (BPM) directives - Within a BPM workflow, you can use the Call SC Workflow
action to initiate the ESC workflow execution. To establish connection, BPM uses the WCF service exposed
by ESC.

10.2.700 143
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

• Updatable Business Activity Query (uBAQ) - Besides using BAQs to display custom views of data, users
can also enter data directly within business activity queries. These uBAQs can utilize events inside Epicor Service
Connect workflows, so users can create and edit records - updating the database through the query itself.
When the uBAQ is created or is being edited, it attempts to create or update the workflow definition, as well as
the corresponding request and response schemas. In order to call the existing workflow to process events or
apply updates, as well as to create the new workflow, uBAQ uses the BPM Integration WCF Service. The service
is installed when the Integration WCF Services feature is installed on the ESC server. In order to use this service,
uBAQ must authenticate in ESC.
For more details on how to configure both applications, review the Epicor ERP and Epicor Service Connect
Interoperability topics found in the Application help.

Default Epicor Service Connect logon parameters are defined on the Company Maintenance > General Settings
sheet.
Navigate to Company Maintenance.
Menu Path: System Setup > Company/Site Maintenance > Company Maintenance

This program is not available in Epicor Web Access.

1. Select the General Settings sheet.

144 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. In the Server field, enter the enter Full Domain Name of the server where the Service Connect application
is installed.

3. Enter the User name and Password of an Epicor Service Connect user account that has rights to the server.

4. Click the Test Connection button to verify the connection to the Epicor Service Connect server is established.

10.2.700 145
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. In the UBAQ Workflow Package field, select the default workflow package where workflows created
from Business Activity Query Designer are placed.

A Workflow Package is the Service Connect equivalent


of a physical folder. It is used to store document processes,
also referred to as workflows in logical groups. A list of
all existing packages displays in the Workflow Packages
node under the Connectivity node of the Epicor Service
Connect Administration Console tree.

At the new workflow creation, you can override this value by selecting a different workflow package than
default.

Configure Service Connect Workflow

Use the following steps to learn how specify the workflow used with the uBAQ, configure workflow design and
run-time credentials.

1. First, specify the ESC server name and run-time credentials you want to save with the query. To do this, click
the Server button.

2. Select one of the following options:


• Use Company Default Server - use this default option to use the ESC server and credentials specified
in Company Maintenance.
• Use Specified Server - use this option to specify custom ESC server parameters:
• Server - enter the Full Domain Name of the server where the Service Connect application is installed.
• Enter the User and Password for the user account that has rights to access Service Connect.

3. Click the Test Connection button to confirm you can access the specified server.
The ESC logon information used when the query activates is now configured within the BAQ.

146 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

4. When you click the Configure button, you are first presented with the Logon To Service Connect dialog.
On this dialog, you can:
• Accept the credentials entered on the Select Epicor Service Connect Server window launched using
the Server button (either company default or custom ones).
• Enter custom ESC credentials you want to use while building the query.

5. By clicking OK, you are presented with the Select Workflow window.

10.2.700 147
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. The Server field displays the FQDN name of the specified server where ESC is installed.

7. The Server URL automatically displays the integration service that handles communication between Epicor
ERP and Epicor Service Connect.
By default, the service URL is https://<server name>/BPMIntegrationWcfService/SCIntegrationWcfService.svc

8. If you want to use an existing workflow, in the Workflows tree view, search for and select a workflow you
want to use.

9. The workflow and package you select display in the Chosen Workflow field.

10. When you click Refresh, the list of packages and workflows is refreshed.

11. When you click the Advanced button, you are presented with the Workflow Context Parameter window.
The information on this window is shared between the BAQ Designer and BPM. The ESC server credentials
you enter allow calling of Epicor services from the Epicor Service Connect side by using imported .Net
references.

12. If you want to create a new workflow, click the Create New button and specify the workflow package and
workflow name.

13. Once complete, in the Select Workflow window, click OK.

14. The following steps discuss how you can create a new workflow / select existing one using the New button.

148 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. If the company default ESC server information is entered on the Company Maintenance > General sheet,
clicking the New button invokes the Enter Workflow window.

16. On this window, in the Select a Workflow package field, you can either accept the default workflow
package or select a different package where you want to save the new workflow.

17. In the Enter new Workflow name field, type the name of the workflow to be created.
Good practice is that BAQ and workflow are named the same.

18. Click OK.

19. The parameters you specified now display in the read-only field.

If on the Select Epicor Service Connect Server window


you select to use ESC server credentials other than default,

10.2.700 149
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

clicking the New button launches the Select Workflow


window. The process here is the same as seen in step 5
onwards.

Standard Template Workflow

The standard ESC template workflow and corresponding schemas are created directly from the Business Activity
Query Designer.

If you perform database updates using Service Connect on an


External Business Activity Query, at the beginning of the
workflow creation process, an updatable BAQ is inspected for
a DataSource Type attached to the query.
• If the Application Type field you define on External
Datasource Type Maintenance is set to Prophet 21,
iScala or Eclipse, the workflow is designed to perform
updates specifically against these external applications.
• If the Application Type field you define on External
Datasource Type Maintenance is set to Generic, the
generic workflow is in created Epicor Service Connect. You
can use this workflow to perform updates to any target
database for which you successfully established connection.

Example The following is an example of a standard workflow


called from BAQ.

150 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

The following is the list of events the generic Service Connect workflow handles:
• GetNew - This method generates a new record and adds it to the database table. If your updatable BAQ
allows users to enter new records, when users create new methods they activate this method. A new, blank
row is created within the updatable table, and the user populates the fields linked to this row with new data.
• Update - This method refreshes the information within the database with new information a user has entered
in the updatable BAQ. When you test your updatable BAQ by modifying existing data, this method runs when
you click the Update button. When the updatable BAQ is embedded within a dashboard, this method runs
when the user enters new data and clicks the Save button.
• CustomAction - Use this method to run custom actions you define on the uBAQ.
• FieldUpdate - This method occurs after the user's change to a field is committed. You can use this method
to perform additional processing against the changed row. For example, when you enter a part number, you
want the part description field to populate automatically.
• FieldValidate - This method occurs before the proposed change to a field is committed. You can use this
method to validate proposed changes. For example, you can prevent users from entering an incorrect value
in a certain field such as non-existent state.
You can customize the workflow so it meets your business process requirements. Use the available Epicor
Service Connect documentation to learn how to build workflows which can automate processes, connect
different business entities, applications, or users.

BPM Update Processing

Use this method to perform database updates using the special Business Object method UpdateExt. This update
method governs the whole data transaction process between the updatable BAQ and the related Business Object.
To use BPM update processing:

1. In the Processing Method pane, select the BPM Update radio-button.

10.2.700 151
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. The BPM Update Processing section activates.

3. Click the Business Object button.

4. The Select Business Object window displays. The business objects for the tables on the current BAQ display
by default in this window.

5. Select the business object you want from the Suggested business objects list.

The list of business objects is suggested based on tables,


participating in the query.

6. The Update Method indicates the method used to enter the changes made through the updatable BAQ
to your database. By default the UpdateExt method displays, which is the update method used on all
updatable BAQs.

7. If you need, you can select a different business object by clicking the Select Business Object button.

8. When you have selected the business object you want, click OK.

9. When you select a Business Object and a method, the Tables to update pane displays the hierarchical tree
of all tables, participating in the UpdateExt method.
After you select a BO, uBAQ automatically attempt to synchronize Column Mappings. If uBAQ display list
contains table fields corresponding to table fields from the UpdateExt tables list, mapping between these
fields is automatically created. Within the Tables to update tree, a checkbox displays next to each table for
which such mapping was found.
In the process of field mapping between BO and BAQ, you can select / deselect different tables based on
your needs. Only tables, checked in the tree -view will participate in Column Mapping and used in update.

152 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. The two sheets at the bottom display columns are mapped with the following distinction:
• The Input Column Mapping defines how data is pulled from the uBAQ table to the Business Object
table.
• The Output Column Mapping defines how data is pulled to the uBAQ from the Business Object, after
the UpdateExt method executes.
The Column Mapping sheets are discussed on the following topic.

11. When you finish, click Save.

Column Mapping

After you select a BO, uBAQ automatically attempt to synchronize Column Mappings. You can modify this
information to create custom mapping between BAQ and Business Object.
The following list outlines how BAQ Column Mapping works:
• If BO table field is used in either Input or Output Column Mapping, then input mapping for all its primary key
fields must be provided in order to uniquely identify table rows.
• Deletion of an input mapping for a key field is not allowed.
• BO UpdateExt tables are organized in the Tree-view. To update a child table, the primary key values of all
parent tables must be supplied in Input Column Mapping.
These required columns are automatically added when you click the Synchronize button, or when you
regenerate the BPM Directive by saving the BAQ.

10.2.700 153
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

• If BAQ cannot suggest mapping automatically, the right side of Input Column Mapping assignments shows
no mappings. A corresponding error message displays when BPM Directive is regenerated on BAQ save.

1. The Query To Object Column Mapping defines assignments of BAQ fields to the Business Object table
fields.

2. The Table field displays the table name, used on the left side of a mapping assignment.
For Input Column Mapping, this field displays the Business Object table name.

3. The Field field displays the Business Object table field name.

4. The .Net Data Type field indicates .NET data type of the field such as Boolean, Integer or String.

5. When the Required check box is selected, it indicates that users must enter data in this field before a new
record is saved. If they attempt to save the field without entering data in it, an error message displays. The
information in this field is supplied from Business Object, where the specific column is marked as required.

6. When the Key Field check box is selected, it indicates this BO field is part of primary key and input value
is required for UpdateExt functionality.

7. The Expression column displays the equation used to pull data from the updatable BAQ into the Business
Object table.

8. You can use the editor to manually create an expression you want to assign (or map) to the
MapTableName.MapTableField. Click the Expression Editor button to launch the Business Object Update
C# Expression window.

9. The Editor displays the expression used to pull data from the updatable BAQ into the Business Object table.

154 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. When you launch the Business Object Update C# Expression from the input mapping, the Add All Mandatory
Fields option becomes available on the Actions menu. This option adds all fields from TopLevel Display
Columns to the output mapping. You must then make sure all empty mapping expressions are filled.

11. To verify the expression is available for use within the uBAQ, use the Check Syntax button. Any errors are
reported in the grid below the Editor pane.
Note the validation process reacts on:
• Empty Expression Statement
• Syntax Error
• Security Issue (non-advanced BPM users)

Make sure the expression you create is written using the


.NET C# syntax. Be aware that no SQL functions and
Operators are applicable on this form. This window is
nearly identical to the Calculated Field Editor. For more
information, review the Create a Calculated Field topic.

12. The Object To Query Column Mapping sheet defines how data is returned to the BAQ from the Business
Object.

10.2.700 155
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

13. For Output Column Mapping, the Table field displays a ttResult variable, corresponding the current row in
BAQ execution results table.

14. The Field field displays the BAQ ttResult field name, containing selected field Alias.

15. You can use the Allow Nulls checkbox to manually specify that result can contain a null value.

16. You can use the Expression Editor button to manually create an expression you want to assign (or map)
to the selected Table.Field. Note that BAQ columns within an expression should be referred as ttResult.Alias
columns.

17. When you launch the Business Object Update Expression from the output mapping, the Add All Result
Fields option becomes available on the Actions menu. This option inspects the BO and adds all fields marked
as required, to the input mapping. You must then make sure all empty mapping expressions are filled.

156 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

18. For both input and output column mappings, you can use the toolbar above the grid to add and remove
rows from mapping and sort columns in an alphabetical order. The Synchronize option inspects all tables
within the BO. If BO tablename and field name exists in the BAQ display field - a new mapping row is
automatically created.

10.2.700 157
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Advanced BPM Processing

Business Objects contain the code that calls a database, sending current data to a custom dashboard for display,
or populating the database with new data. A business object (also called a BO) houses the methods used to
enter, view, and calculate data for a specific function within an application.
Each process a business object can run is called a method; by default each updatable BAQ contains the following
methods:
• GetNew - This method generates a new record and adds it to the database table. If your updatable BAQ
allows users to enter new records, when users create new methods they activate this method. A new, blank
row is created within the updatable table, and the user populates the fields linked to this row with new data.
• Update - This method refreshes the information within the database with new information a user has entered
in the updatable BAQ. When you test your updatable BAQ by modifying existing data, this method runs when
you click the Update button. When the updatable BAQ is embedded within a dashboard, this method runs
when the user enters new data and clicks the Save button.
• Get List - Retrieves the data specified by the query.
• CustomAction - Use this method to run custom actions you define on the uBAQ.
• FieldUpdate - This method occurs after the user's change to a field is committed. You can use this method
to perform additional processing against the changed row. For example, when you enter a part number, you
want the part description field to populate automatically.
• FieldValidate - This method occurs before the proposed change to a field is committed. You can use this
method to validate proposed changes. For example, you can prevent users from entering an incorrect value
in a certain field such as non-existent state.
Each of these methods can be monitored through Business Process Management (BPM) directives. BPM
customization allows using of mostly all BPM Method directive actions and conditions for processing query data.
When you create an updatable BAQ, the application writes a base processing directive for the update method.
The directive uses C# code to update the database according to the settings defined in the Business Activity
Query Designer. These directives can evaluate the data passed into or out of the database, interrupting the
processing when certain conditions you define are met. Various actions, again which you define, then automatically
run in response to the condition. You create these Updatable BAQ Method Directives from within the Business
Activity Query Designer, or, you can access the program directly from the main menu:
Menu Path: System Management > Business Process Management > Updatable BAQ Directives Maintenance

This program is not available in Epicor Web Access.

To following are the ways of using the Advanced BPM processing functionality:

1. Business Activity Query Designer helps users with updating data via a selected business object. For these
purposes, the UpdateExt method is used. This update method governs the whole data transaction process
between the updatable BAQ and the related Business Object (BO). When you select the BPM Update option
on the Update Processing sheet, you activate the BPM Update Processing section to configure data updates.

158 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. You do this by selecting an appropriate Business Object and defining data Mappings between BO's dataset
and query display fields.

3. Click the BPM Directives Configuration to access the Updatable BAQ Method Directives.

4. Based on the information you specified in BPM Update Processing, the BAQ Designer generates the Base
Processing directive against uBAQ.Update method.

10.2.700 159
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. This directive is named #BASE# and contains a workflow item with custom C# code, which prepares data
and calls UpdateExt for selected BO.
Access to #BASE# directives is only available to users having Advanced BPM User rights.

In Epicor Cloud ERP - Multi Tenant, this program or


feature may not be available or may operate under certain
restrictions.

160 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. Also, Base Processing directive for the GetNew method is automatically generated if the Allow New Record
option is selected on the Update > General Properties sheet. This directive is also named #BASE# name
and it contains C# code with field assignments for new row as defined in Initial Expression column defined
on the General Properties.

When you use BPM Update option to perform uBAQ


updates, do not edit #BASE# directives because any
changes will be discarded once the query is saved in BAQ
Designer.

7. However, the BAQ Designer gives you the ability to modify the directives for any methods. By using the
Advanced BPM Update only option, you can create a BPM directive manually from scratch, or, to customize
the directive generated by BPM Update processing.

8. If you do not specify BPM Update Processing and launch Updatable BAQ Method Directives, then no #BASE#
directives are generated automatically for the GetNew and Update methods. Use this option to customize
the method completely by yourself.

You should always create Base Processing directives


for all updatable query methods you want to call.
Otherwise the error message "There is no BPM
customization attached to Update method of test
updatable query in XYZ company" displays.
The exception to this rule, are GetList and GetNew
methods, which have the base processing functionality
embedded. For these methods, creation of
Pre-Processing and Post-Processing directives is
reasonable.

For more information on how to build a directive and which workflow elements are available for use with
uBAQ directives, review the Business Process Management chapter.

Analyze

Use the Analyze sheet to both analyze and test your query for any possible problems before you use it in the live
application.
Run the data controls on this sheet to verify that the data results you need populate on this grid. If you are not
seeing the results you want, you can return to the Query Builder sheets to modify the query and then test the
results again.
Additionally, the Analyze sheet contains the functionality you use to verify and updatable BAQ can pull in (get)
data, update records, and add new records. You can also use this sheet to test a custom Business Process
Management (BPM) method against the updatable BAQ. After you verify the updatable BAQ can perform all of
the functions successfully, you are ready to place it on smart client and mobile device dashboards. Users can then
enter and update the data they need through this query.

BAQ Designer allows testing update operation on records


belonging to current company only.

10.2.700 161
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Analyze and Test the Query

After you create a query, verify its functionality on the Analyze sheet.
To verify a query:

1. Navigate to the Analyze sheet.

2. Click the Analyze button.


The Query Execution Messages pane displays the response from the server, indicating whether the syntax
is correct.
If the BAQ Designer detects any SQL syntax errors, the Query Execution Messages pane displays the
message corresponding to error. In case of possible SQL injection, the query execution is not allowed and
the Query Execution Messages pane displays the corresponding message. For security reasons the Query
Execution Messages pane does not display any detailed information or guidelines on how to correct the
error, if the query execution disallowed due to possible SQL injection. You can get detailed information from
the App Server log file to analyze and correct the error.

3. To set the maximum number of rows returned by the query, you can select a value from the Rows to Return
list.
You can either select one of the predefined values or you can enter a custom value:
• <empty>
• 10
• 50
• 100
Note the value entered in this field is not saved with the BAQ, it is used for testing purposes only.

162 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

If an empty value is selected, then, by default, the query returns maximum of 10,000 records. This limitation
is only applied on retrieving BAQ results while testing their execution. If you need to turn this limit off, from
the Actions menu, click Execution Settings and set the RemoveTestRowLimit parameter to True.

4. Click the Test button.


The data you are pulling in and displaying through your query displays in the Query Results grid. In this
example, the BAQ retrieves the list of customers from the Customer table.
If the BAQ Designer detects any issue, the Query Execution Messages pane displays "Bad SQL Statement.
Review the server event logs for details" message. Press Analyze button to view the message corresponding
to error.
You can get detailed information from the App Server log file to analyze and correct the error.

5. If the BAQ runs too long, you can cancel its execution using the X button that displays to the right of the
Clear Grid button.

This feature is only available for BAQs executed in an MS


SQL database. The SQL Server account used by your Epicor
installation must be provided with the ALTER ANY
CONNECTION and VIEW SERVER STATE permissions to
cancel query execution.

6. To remove the query results and Query Execution Messages, click the Clear Grid button.

10.2.700 163
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

When using Analyze, Test, and Get List buttons, as well


as during query execution, the tables referenced by the
query are checked.
For standard tables, which belong to Ice or ERP database
schema, it is verified that tables are published through
zData and accessible in the configuration the query is
executed in. For tables, which belong to Extension sets,
if the Extension set is installed in the system, but disabled
or not mapped in the current company, a warning
message displayed in Query Execution Messages pane,
but the query is allowed to proceed. On SaaS installations,
XXXChunk/XXDef tables can not be executed, except
GSM User.
If one of extension tables referenced by a query, which
belongs to unknown Extension set, query execution is
disallowed and modifications are not saved. When query
execution is disallowed, an error message is displayed in
Query Execution Messages pane of the BAQ Designer.

164 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Test the Updatable Query

Before you use verify the updatable BAQ functionality, define what fields users can update and set up a processing
method of your choice. You do both tasks using the sheets under the Update tab.

When you create an updatable Cross-company query, please


note BAQ Designer allows testing update operation on records
belonging to current company only. Also, a Cross-company
updatable BAQ cannot be used to create the mobile application
(dashboard).

1. To set the maximum number of rows returned by the query, you can select a value in the Rows to Return
field.
From the drop-down list, you can either select one of the predefined values or you can enter a custom value:
• <empty>
• 10
• 50
• 100
Note the value entered in this field is not saved with the BAQ, it is used for testing purposes only.
If an empty value is selected then by default, the query returns maximum of 10000 records. This limitation
is only applied on retrieving BAQ results while testing their execution. If you need to turn this limit off, access
Execution Settings from the Actions menu and set the RemoveTestRowLimit parameter to True.

2. Click the Get List button to test whether the updatable BAQ can pull in data from the database.

10.2.700 165
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. You are warned this test may launch BPM directives that update the database. Click Yes.

4. If the BAQ runs too long, you can cancel its execution using the X button that displays to the right of the
Clear Grid button.

• This feature is only available for BAQs executed in a


MS SQL database.
• The SQL Server account used by your Epicor installation
must be provided with ALTER ANY CONNECTION and
VIEW SERVER STATE permissions in order to cancel
query execution.

5. The Query Results grid populates with data. You now can test the BAQ to find out if you can update
existing records.

6. In the Query Results grid, double-click on a row.

7. The Fields window displays. This window contains all of the fields you indicated were updatable on the
Update > General Properties sheet. Enter a new value in one of the fields.
In this example, you modify the address of a supplier record.

166 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

8. If an updatable field was selected to raise BPM events within the Updatable field editor, two additional
buttons display next to this field. The V button performs the FieldValidate BAQ method directives; the U
button performs the FieldUpdate BAQ method directives described for the field.

9. Click OK to exit the Fields window.

10. The record you updated is now highlighted within the Query Results sheet.

10.2.700 167
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. If you want to save this change to the database, click the Update button.

12. The record is now updated. To verify the update to the database was successful, you can click the Get List
button again to retrieve the updated DB results. You can also open a specific program that should reflect
your changes, for example, Supplier Maintenance and verify your changes there.

13. If you want to add new records to the updatable BAQ, click the Get New button.

This option is only available when you select the Allow


New Record check box on the Update > General Properties
sheet.

14. A blank row displays on the Query Results list. Double-click the empty row.

168 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. The Fields window displays. Initially, all the fields are blank Enter the values you need to create a new record.
In this example, you create a new supplier record.

16. In the Fields window, click OK.

17. On the last row of the Query Results grid, the new record displays.

10.2.700 169
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

18. If you want to save this change to the database, click the Update button. The new supplier record is now
created. To verify the update to the database was successful, click the Get List button again to retrieve the
updated DB results.

If uBAQ supports Multiple Row Update set on the Update


> General Properties, then several rows can be edited
before clicking Update button. Otherwise - only one row
can be edited.

19. If you created custom actions for the updatable query and then used the Updatable BAQ Method Directives
program to set up conditions linked to this action, you can test this directive. To do this, first select the
custom action you want from the drop-down list and click the Run Custom button.
If the updatable BAQ directive is set up correctly, the Business Process Management (BPM) condition and
its subsequent actions run as expected.

170 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Where Used

Use the Where Used sheets to review all the items that use the current query. The information on these sheets
helps you decide if you should modify the current query, delete the query, or create a new query.
Be careful if you decide to modify the query: any changes impact other applications that use this query.
If you attempt to delete a query that is in use, a warning message displays verifying whether you want to continue
deleting the query. Typically, you should not delete any query in use unless the BAQ is obsolete or no longer
needed. After you delete the query, you should remove or update the dashboard, BAQ report, or other items
that previously used it.

If several user dashboards use the current query, you should


not change it, but rather create a new shared query that
contains the changes you need. Other users can then decide
if they want to use your new query in their dashboards, reports,
and other items.

To access the information:

1. Navigate to the DashBoard List sheet to review which dashboards use the current query.
Dashboards are flexible, powerful tools that provide easy access to critical information in a real-time
environment. In addition to the standard dashboards provided with the application, you can also create
custom dashboards. Custom dashboards can replace the need for workbenches, trackers, ShopVision reports,

10.2.700 171
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

ad hoc reports, and business intelligence reports. For more information on how to create a dashboard,
review the Dashboards chapter.

2. Navigate to the Quick Search List sheet to review which quick searches use the current query.
The Quick Search functionality is a dynamic tool you use to create configurable searches you can then use
within your own user account or share publicly with other user accounts - improving the productivity of
searches. For examples of how to use this functionality, review the Searches chapter.

3. Navigate to the BAQ Report List sheet to review which BAQ reports use the current query.
Use the BAQ Report Designer to turn a Business Activity Query (BAQ) into a report. Through the BAQ Report
Designer, select a query as the base for a report, and to define the option fields, filters, and sort by options
that display on the report interface. Once you have the report layout complete, add it to the menu for users
to access. For more information on this functionality, review the BAQ Report Designer chapter.

4. Navigate to the Report List sheet to review the report data definitions that use this query as data source.
You can use a business activity query as a data source for report data definition. Report data definition is
used to create and edit the table structure of each report. It defines report's main attributes and identifies
the tables and fields that you can display on the report. For more information on using report data definitions,
review the Report Data Definition topic in Epicor ERP Implementation Guide.

5. Navigate to the Business Activity Query List sheet to see any references of the selected query to another
queries.
You can link a business activity query as a parameter to another query. These parameters can filter data on
the query; define what values from the linked BAQ are used as parameter values. Add parameters to a query
through a criterion you set up within the Business Activity Query Designer. For more information on using
parameters, review the Specified Parameter topic earlier in this chapter.

For a list of all field descriptions used on the Where Used


sheets, refer to the Business Activity Query – Where
Used topics within the application help.

172 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

BAQ Search

Use the BAQ Search sheet to make data from your query available to users searching for related data. Many
standard search forms throughout the application contain a BAQ sheet. This sheet provides users with the access
to BAQs you have identified through the BAQ Search sheet.

You must indicate the query as Shared (on the General sheet)
before users can access this BAQ search in search programs.
You cannot use system queries on the BAQ Search sheet. If
you want to use a system query, create its copy first.

1. Navigate to the BAQ Search sheet.

2. The Available “Like” Columns list contains all the fields you selected for your query on the Query Builder
> Display Fields > Column Select sheet.

3. In this example, the Part_PartNum column is used.

4. First you highlight this column in the list of Available “Like” Columns and then click the Right Arrow button.

5. The column is moved to the BAQ Search "Like" Columns list.


The list contains the items you move over from the Available “Like” Columns list. Users searching for
information similar to the data contained in the items in this list can access your BAQ.

10.2.700 173
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Click Save.
Since the Part Number field was selected as the Like column for searching, any place you can search for a
part has this BAQ listed and available for searching.

7. To test the BAQ Search, launch Part Maintenance.

8. Click the Part button.

9. In the Part Search window, navigate to the BAQ sheet.

10. The Search Results pane in the search window displays the query information. You can use the BAQ to
search for a specific part.

For examples of how to use this functionality, refer to the BAQ Searches section in the Searches chapter.

Comments

Use this sheet to enter notes to your query.

The comments for system Business Activity Queries display in


read-only format.

174 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Actions

The Business Activity Query Actions menu contains a number of tools you can use. This section describes each
of these tools.

Copy Query

The Epicor application contains system queries that control how users enter and update data throughout the
database. These queries are a great starting point for creating your own modified queries. Although you cannot
change a system query, you can copy a system query, rename it, and modify this copied query as you need.
You use the Copy Query option to duplicate an existing query.

1. Click the Query ID button to search for the query you are going to copy.

2. In the Query Search window, click the Search button and select the query that you are going to copy.

3. In this example, select zContactTracker01.

4. Click OK.

5. Notice the System. No Save. In Use icon displays. The icon indicates the selected query is a system query
that cannot be edited. It also indicates this query is used by a program, report, or owned by another author.

10.2.700 175
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. In this example, the system zContactTracker01 query is used on a quick search. You can find the specific
dashboard and quick search that contains this BAQ on the Where Used sheets.

7. You want to use this query as a base for a new query. From the Actions menu, select Copy Query.

8. In the Query ID field, enter the new name for the copied query. Be sure to enter an identifier that is different
from the ID listed in the Copy From section.

176 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Optionally, you can enter a new Description for the query.

10. Click OK to save the query with the new name.

11. The message displays, indicating the query was copied successfully. Click OK to close the message.

12. The new query now displays for you to modify.

You can now add tables, new display fields, calculated columns, make the BAQ updatable, and so on to the
copied query.

Export BAQ

Use this command to save the query definition. Once you select the query you want to export, you can export it
to a folder you specify during the BAQ export. You typically use this option to create a backup of your BAQ or
if you want to use or analyze the query on another installation. If needed, you can import it back into the
application.

This process only exports the query definition, not the data.
The Business Activity Query Export Process program, discussed
later in this chapter, can export the query data.

1. On the General sheet, select the query you want to export.

10.2.700 177
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Once you have a query in focus, from the Actions menu, select Export BAQ.

3. In the Description field, you can change the current description of the query.

4. Click the browse button next to the File field to find and select the folder that will contain the exported
BAQ. You need to select the directory path and enter the filename - for example,
c:\Users\User\Documents\MyContactQuery.baq.

5. For updatable BAQ utilizing events inside Epicor Service Connect workflows, you can select the Export SC
Credentials check box. The ESC credentials used when the BAQ executes are exported along with the BAQ
definition.

178 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. Click the Export button.

7. The Export process messages field details the results of the export.

While exporting the query export file, the query is analyzed


for the Extension Set. If any table or field from the
Extension Set is referenced by the query, dependency
information displays in the Export process messages
field:
Exporting query dependencies information
...
The query referes to tables from extensi
on set(s):
Extension set id: sp/ExtensionTipEx
Provider: spProvider_0
Level: Extensibility
Product: spProduct
Version: 1.1.1.1
Extension set id: zp/ExtensionTip
Provider: zpProvider_0
Level: Productization
Product: zpProduct
Version: 1.1.1.1
Done!

8. If the export is successful, the “Query export finished with success” message displays.

9. Click Close.

Import BAQ

Once you have exported a version of a query, you can use the Import BAQ option from within the Business Activity
Query Designer program to pull the query definition back into the application.
To use the Import BAQ command to import a query:

1. From the Actions menu, select Import BAQ.

10.2.700 179
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the Import File button to find and select the BAQ you wish to pull into the application.

You can import multiple BAQs at once. When searching


for queries, hold Ctrl and select the BAQs you want to
pull into the application. If the query you import already
exists in the database, you are presented with the warning
message, asking whether you want to overwrite the BAQ.

3. Enter the New Query ID. In this example, you import the MyContactQuery–Rev2 query.
This field displays in the read-only mode when you import multiple queries.

4. Select the Show in Designer check box to immediately load this query into the Business Activity Query
Designer program.
This option is disabled when you import multiple queries.

5. Click Import to import the query.

In the Business Activity Query Designer a query is imported


only into the current company.

6. The Import process messages field details the results of the export.

While importing the Import file is analyzed for an


Extension Set. Referenced information on Extension Set
is displayed in the Import process messages field. If an
Extension Set of the imported extension table reference
is not enabled or added to the target system, the following
message displays in the Import process messages field:
Importing query dependencies information
...
Warning! Query refers to extension table
s from extension set that is not enabled

180 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

or mapped to current company.


Importing extension set information:
Extension set id: sp/ExtensionTipEx
Provider: spProvider_0
Level: Extensibility
Product: spProduct
Version: 1.1.1.1

Warning! Query refers to extension table


s from extension set that is not enabled
or mapped to current company.
Importing extension set information:
Extension set id: zp/ExtensionTip
Provider: zpProvider_0
Level: Productization
Product: zpProduct
Version: 1.1.1.1

Done!

7. If you are importing an updatable BAQ configured to utilize events inside ESC workflows, the following
dialogs display. First, on the Select Epicor Service Connect Server window, you are asked to specify BAQ
runtime credentials.

For BAQs of different types, the following two dialogs do


not display.

8. All fields on this form are filled with data coming from the exported uBAQ definition. If the query was
exported without ESC credentials, the Use Company Default Server option is selected by default.

9. Click Test Connection and verify the credentials you chose are valid.

10. Click OK to proceed to the following dialog.

11. Secondly, you are presented with the Logon to Service Connect window.
This window only displays if Show in Designer check box is selected while importing the query.
The credentials you enter on this window are specifically used for the WF Design. These credentials are not
saved with the query, they are only stored until the BAQ Designer form is opened. By default, ESC credentials
you selected on the Select Epicor Service Connect Server window are offered.

10.2.700 181
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. Click OK to complete the process.

13. If the import is successful, the “Query Import finished with success” message displays.

14. Click Close.

In Epicor SaaS installations (Epicor hosted environments),


a user with Global Security Manager rights (GSM) has
the ability to overwrite a BAQ in another company or
owned by another user. The following rules describe the
import process:
• On BAQ import, the query attempts to be imported
into the original company which is defined in the .baq
query definition.
• If the target company already contains the BAQ, a
GSM user is prompted to overwrite the query.
• If GSM selects Yes on this dialog, the target query
is deleted and the new query definition is imported.
• If GSM selects No, the BAQ import tried to import
the query into the current company and change
authorship to the current GSM user.

• If the same query ID exists in the current company,


additional warning message displays for the user.
• If user clicks Yes, the current query is replaced with
the imported one.
• Selecting No interrupts the import process.

Note the above process does not apply to BAQs visible


across companies; when importing a query of All
Companies type, a GSM user has the same rights as an
ordinal user.

The options/values for tenant and multi-tenant features


are only for Epicor hosted environments. Typically you can
ignore these options. Internal Epicor administrators who
need more information should refer to the Epicor SaaS
Installation Guide.

182 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Change Author

When a query is created, only the author of the query can modify it. To give another user rights to modify a
query they did not create, use the Change Author command to assign a new author to the query. The Change
Author command is only available when you are the author of the query.
To give another user access to your query:

1. From the Actions menu, select Change Author.

2. The Change Author window displays.

3. The name of the current BAQ owner displays in the Author field.

4. Click the drop-down list to select the new author of the query.

5. The new author’s User ID displays within the Change Author window. In this example, you assign AARON
to become the new BAQ author.

10.2.700 183
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Click OK to confirm your selection.

7. The new Author displays on the General sheet.

8. Notice the Other owner. No Save red icon indicates you no longer can save changes to this query.

Run BPM Designer

To complete the updatable BAQ, use the Run BPM Designer command to set up how the BAQ interacts with the
business object's methods. Business Objects contain the code that calls a database, sending current data to a
custom dashboard for display, or populating the database with new data.

This Actions menu is only allowed if the query in focus is


Updatable.

1. Click on the Actions menu and select Run BPM Designer.

184 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. The Updatable BAQ Method Directives window displays.

3. All of the available updatable BAQ method directives display.

4. You can create three types of method directives.


• Pre-processing directives evaluate data before it is saved to the database. Use pre-processing directives
for validation and other tasks you want run before the data updates your database.
• Base Processing directives substitute the normal operation of the business object with custom code
you create. Epicor recommends you never create base processing directives; only create base processing
directives with your consultant or Directly through Epicor. If your base processing directive does not
work, you will potentially harm the operating functions of your application
• Post-processing directives evaluate data that is saved to the database, but is now being returned to
the interface for display. Use post-processing directives when you want to generate an event based on
the data recently recorded to the database.

5. When you finish creating your updatable BAQ method directives, exit the program.
For more information, review the Updatable Business Activity Query section discussed earlier in this
chapter.

10.2.700 185
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Define Custom Action

Use the Define Custom Action command to create action placeholders available for use with the business activity
query (BAQ).

This Actions menu is only allowed if the query in focus is


Updatable.

1. Click on the Actions menu and select Define Custom Action.

2. The Define Custom Action window displays.

3. To create a new action, click the New button.

186 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

4. Enter an ActionID. This identifier defines the custom action within the updatable BAQ.

5. Enter an ActionLabel. This value defines how the action displays on buttons within the dashboard.

6. If you wish to remove a custom action, click the Delete button.

7. Continue to add the custom actions you need. When you finish, click OK.

The custom actions you add through this functionality are placeholders you can then leverage within the Updatable
BAQ Method Directives program. You use this program to create conditions that monitor these custom actions.
When a user enters data which matches the condition, the condition runs th e specific actions linked to it, like
validating data or displaying an informational message.
For more information, review the Updatable Business Activity Query section discussed earlier in this chapter.

Define Parameters

Use this option to create alternative query parameters. You can then evaluate table or subquery columns against
these parameters when building query criteria. These parameters can be nearly any value you need.
You can also use parameters to display customized method arguments for use in Business Process Management
(BPM) directives.
The query text contains references to arguments using this format: @arg_name

Example

select * from dbo.PartCOPart as PartCOPart


where PartCOPart.CoRevisionNum = @CustomParameter
This argument reference is replaced by the argument value when the query activates.
You access these parameters on Table Criteria or SubQuery Critera, when you

1. From the Actions menu, select Define Parameters.

2. The Query Parameters window displays.

10.2.700 187
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Example You can, for example, create a drop-down list


that is filled with data supplied by a query.

For more information on how to build a query parameter


and use the controls on this window, review The Query
Builder > SubQuery Criteria > Specified parameter
topic discussed earlier in this chapter.

Execution Settings

Use the Execution Settings command to modify execution parameters of the selected BAQ.
You can set up paging parameters to indicate how the BAQ should get a sub-selection of data from a record
set, specify the longest time in which the query can run, or supply SQL statements, clauses, and keywords to
modify the resulting SQL syntax.
If you need to break the returned data into several pages:
• make sure the PageSize is set to a positive number equal to the number of rows you want to display on each
page. Otherwise, if PageSize is set to default 0, the paging is not applied.
• note that paging applies starting from the page number specified in the PageNum setting.

Example If the PageNum is 3, the PageCount is 4, and the


PageSize is 5, the data returned by the query is broken into
4 pages with 5 rows each, and the first record in the results is
table row 11.
If the number of database records is less than the number
assumed by the paging settings (in this example, 30), the

188 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

number of returned pages can be less than the defined


PageCount.

The table below lists the execution values you can define.

Execution Setting Description


Timeout
The value in this field specifies the longest time (in seconds) in which a query can run.
Specifying 0 for this option turns off the query governor, and all queries are allowed to
run indefinitely.

PageSize
The value in this field specifies how many rows per page are retrieved in the result set.
The available values include:
• 0 - Paging is not used.
• Any positive number - Specifies number of rows per page.

PageNum
The value in this field specifies the page number user wants to get. The default value is
1.
Be aware that if you for example, set this value to 10, but the BAQ only returns 3 pages
of data, an empty result set displays.

PageCount The value in this field specifies how many pages of data the query returns. By default,
PageCount is set to 1 meaning that the returned data is displayed on a single page. You
can set this value to any positive number greater than 0.
PagingMethod
The value in this field specifies the method used to retrieve data from the datasource.
The available values include:
• Auto - This is the default paging method. When selected, the DynamicQuery tries to
automatically select the most appropriate paging method, supported by BAQ definition
and database engine.
• Simple - When a query executes, its results return through DbDataReader, but only
required page is loaded to the result table. This paging should work for any database,
so use it explicitly if Auto method does not work for some reason.

NeedTotal
This field specifies if total number of rows in the query is received (without paging). If this
flag is set to True, the ExecutionInfo table in the result dataset, returning from query
contains total number of rows.
The value in this field should be set to False whenever possible to reduce the server
load.

Where
Setting name of additional conditions in SQL notation which are applied against results
table. Only display fields and BAQ/SQL constants be referenced. You can use where
statements of any complexity including and/or concatenations. If ExecutionFilter table
contains any conditions then they will be applied before this ‘where’ condition.
Make sure you reference fields using the BAQ Alias notation in the following format:
TableName_FieldName.

Example ABCCode_Company =
'EPIC06'

10.2.700 189
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Execution Setting Description


Select
Setting name for SELECT. This is comma-delimited list of fields in SQL notation. Use this
setting to narrow set of fields returned by query. Note you can only reference BAQ's
display fields.
Make sure you reference fields using the BAQ Alias notation in the following format:
TableName_FieldName.

Example ABCCode_ABCCode,
ABCCode_Company

Having
Setting name for statement that appears in the HAVING clause in addition to query
settings.
Make sure you reference fields using the BAQ Alias notation in the following format:
TableName_FieldName.

Example ABCCode_StockValPcnt <


90

OrderBy
Setting name for comma-delimited list of fields by which you want sort the query result.
Optional direction can be specified in SQL notation (ASC/DESC).
Make sure you reference fields using the BAQ Alias notation in the following format:
TableName_FieldName.

Example ABCCode_ABCCode DESC

GroupBy
Setting name for comma-delimited list of fields by which you want to sort query results.
Make sure you reference fields using the BAQ Alias notation in the following format:
TableName_FieldName.

Example ABCCode_Company

SQLServerDateFormat
This setting adds SET DATEFORMAT call at the beginning of the query. This setting should
only be used MS SQL Server.
The available options include:
• mdy (month-day-year) - default option
• dmy (day-month-year)
• ymd (year-month-day)

Transaction Isolation
This setting sets transaction isolation level which controls the locking and row versioning
behavior of Transact-SQL statements issued by a connection to SQL Server.
The available options include:
• NotSet - No Transaction Isolation specified by the BAQ engine. When the query
executes, the default Transaction Isolation Level specified in the corresponding DB
provider is used. This option is set by default.

190 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Execution Setting Description


• ReadUncommited - Specifies that statements can read rows that have been modified
by other transactions but not yet committed.
• ReadCommited - Specifies that statements cannot read data that has been modified
but not committed by other transactions.
• RepeatableRead - Specifies that statements cannot read data that has been modified
but not yet committed by other transactions and that no other transactions can modify
data that has been read by the current transaction until the current transaction
completes.
• Serializable - Specifies that statements cannot read data that has been modified but
not yet committed by other transactions. No other transactions can modify data that
has been read by the current transaction until the current transaction completes. Other
transactions cannot insert new rows with key values that would fall in the range of
keys read by any statements in the current transaction until the current transaction
completes.
• Snapshot - Specifies that data read by any statement in a transaction will be the
transactionally consistent version of the data that existed at the start of the transaction.

queryMaxResultSet
Specifies maximum number of rows that will be returned by the dynamic query.

queryTimeOut
By entering a value in this field, you define the database server command timeout before
terminating the attempt to execute a command and generating an error.

Persist in Query
All execution settings can be flagged as persistent or not.
If the check box is clear, any specified settings will apply to the current BAQ session only,
until the BAQ form is closed.
If the execution setting is flagged as persistent, it will be used each time the BAQ runs.
If a BAQ supplies some execution setting on execution, while the same persistent execution
setting exist, then the first one has higher priority.
There are two parameters that are always persistent - QueryMaxResultSet and
queryTimeout; these are stored in the database with the query. All other execution settings
can be persistent or not.

• Within the Epicor Administration


Console > Application Server
Settings, you can define limits that
apply to all BAQs executed by the
application.
• For external BAQs, limits can be
specified in the related external
datasource.
• User can only specify limits for one
particular query. These limits can
exceed application limits only if the
user, who edits and saves a BAQ, is
a Security Manager. Other users can
set only values that do not exceed
maximum values specified in

10.2.700 191
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Execution Setting Description

Application Server Settings or an


external datasource.

RemoveTestRowLimit
This setting controls if the BAQ Designer is allowed to return more than 10000 rows while
testing BAQs.
For performance reasons, this parameter should be set to it's default False value
whenever possible.

This parameter has no affect on another query limits you may specify; it only controls the
data retrieval limit while testing BAQs.

ExecutionTraceLevel
This setting option does not display in the drop-down and needs to be typed in manually.
Add this setting with any value - for example, true, or 1, etc. to make the BAQ return
additional data about query execution. You can use this data for BAQ performance analysis.
The following additional performance counters get included into the query output:
• QueryPreparationTime
• SQLExecutionTime
• DataFetchTime
• TotalRows

You can get the values of these


counters by calling the
DynamicQuery.Execute method via
REST - for example, from the Epicor
REST API interactive help site.

Use Primary Database


When the Always On availability groups feature is activated on the SQL server, you gain the ability to request
that specific queries are routed to the read-only database. If the Use Primary Database option is not selected,
when building the query results, the application will request a connection to a read-only database, if available.
However, if your company does not have a read-only replica of the database, all standard BAQs will be executed
against the main database regardless of whether the Use Primary Database option was selected. This option
is selected automatically for Updatable Business Activity Queries (uBAQs) because they require assured access to
the most up-to-the-second data.
If you are interested in learning more about how SQL Server can be configured to support the read-only
database capability, please refer to the Microsoft® documentation for information on the Always On
availability groups feature of the SQL Server®.

192 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Get Query Execution Plan

Use the Get Query Execution Plan to retrieve and save the .sqlplan execution file. You later open this file in
the SQL Server Management Studio to examine the query execution.

Example You can use this feature to determine what is


causing the problem in the slow running query.

This feature is available for both internal and external MS SQL


queries. This command requires the VIEW SERVER STATE
permission for the IceContext connection.

1. From the Actions menu, select Get Query Execution Plan.

2. In the Save SQL Server Query Execution Plan window, you can specify the name and the location where
you want to save the .sqlplan file.
By default, the file is named using the following format: <QueryID>.sqlplan

10.2.700 193
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. Click Save.

4. To the informational message, click OK.

5. Once the file is saved, open it using the SQL Server Management Studio for further analysis.

For more information, refer to the available msdn


documentation.

194 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Change Security Code

Use this action to change the Security Code of system Business Activity Queries (BAQs) and Updatable BAQs
(UBAQs).

This action is available to users with Security Manager rights


when a system BAQ/UBAQ is opened in the Business Activity
Query Designer program.

1. In the Business Activity Query Designer program, open a system BAQ - for example, COM-CustContacts.

2. From the Actions menu, select Change Security Code.

10.2.700 195
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

The Change Security Code dialog window displays.

3. Type in or browse and select the Security Code you wish to apply to the system BAQ/UBAQ.

Click Reset to default to change the Security Code to its default system value.

4. Click OK.
The updated Security Code is applied to the BAQ/UBAQ immediately, you do not need to save the changes
in the program.

Reset Field Attributes Cache

Use this action to remove cached field attributes.


Each database field has a set of properties such as format or label/caption, etc. Unless you manually specify new
attribute values for query fields, the Business Activity Query (BAQ) Engine uses the default system Field Attributes
taken directly from the database. Once these attributes are retrieved, the system temporarily stores them on the
server for one hour. This eliminates the need to request this metadata from the database at each BAQ run.
Use the Reset Field Attributes Cache action to immediately remove the server-side cache that stores system
Field Attributes data and apply changes made to Field Attributes in the database to the query.

196 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Export Query Data

Run the Business Activity Query Export Process to export the query data from your database and store it in a
personal archive directory. This data can then be used on an ASP page, or imported to Microsoft® Excel® for
analysis and publishing.
Use the Business Activity Query Export Process program to export query data through either the .xml or .csv file
formats. You can export this data each time you launch this program. You can also set up the export so that it
automatically runs each time you launch your Startup Tasks.
Menu Path: System Management > Business Activity Queries > BAQ Export Process

This program is not available in Epicor Web Access.

To use this program:

10.2.700 197
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

1. Click the Query ID button to search for and select the query to export.

2. From the Output Format drop-down list, select the export format you want to use. You can choose either
XML or CSV file formats.

3. Enter the Output Filename for the exported query. By default, this file is automatically saved on the server
within the EpicorData > Processes > <UserName> directory - where <UserName> is the name of the
current user logged into the application. The may look as follows: C:\EpicorData\Companies\EPIC
06\Processes\MANAGER. The location of this data directory is specified in System Agent Maintenance.

For Epicor Cloud ERP users, the path is ...\Companie


s\siteID\siteID-<UserName>.

You can override the default output location by exporting the file to a custom location you define. It is
allowed to use:
• Relative paths (root folder level only), for example, temp/filename.csv
• Network paths, for example \\server\share\folder\filename.xml
The correct file extension is attached during each export. If you select that the output will be an .xml file,
the .xml extension is automatically added to the file name.
If you don't have direct access to the server file system, such as with SaaS and Early Access, use the Server
File Download utility. It transfers one file at a time from one of three directories on the server: Company,
User, or Reports to the client. Specify the file type, select the file, and then browse for a path for the
download. This program is found in System Management > Schedule Processes.

4. For CSV output format, you can enter the Text Delimiter. For example, if you place a semi-colon (;) in this
field, this character separates the data in the exported file.

5. For CSV output format, if you want to display field labels in the export file, select the Output Labels check
box.

198 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. From the Schedule drop-down menu, select a schedule you want to use.

For more information on creating schedules, review the


System Agent Maintenance topics within the application
help.

Example
You can select the Startup Task Schedule from the
Schedule list and select the Recurring check box. This way
you export this query each time you run your startup tasks.

7. Click the Submit button to submit the schedule for processing.


If you export a query with parameters, the Query Parameters form is displayed. You can specify or change
default parameter values, which will be used along with current settings. If you do not enter parameter
values, the query selection is not allowed.

Results of the BAQ Export Process reports are reported in the System Monitor log.

BAQ Application Server Settings

Within the Epicor Administration Console, several application server settings are available for use with BAQ
functionality. You can restrict how business activity queries generate results. This can help you avoid performance
issues caused when BAQs process large amounts of data. You can also indicate if BAQ database calls should be
recorded in the server log.

1. You launch the Epicor Administration Console from your server machine. Depending on your operating
system, you launch this tool in different ways:
• If you are on Windows SQL Server 2008 R2, click Start > All Programs > Epicor Software > Epicor
Administrative Tools > Epicor Administration Console.
• If you are on Windows SQL Server 2012, press the <Windows> + F button to display the Charms bar;
from the Apps screen, select Epicor Administration Console.

10.2.700 199
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. From the tree view, expand the Server Management node and Epicor Server node.

3. Select the application server you need to monitor.

4. Now from either the Action menu or the Actions pane, select Application Server Settings.

5. For the BAQ Query Max Result Rows field, leave the default setting at 0, indicating there is no row limit.
If you have a BAQ that is returning a large number of rows and is affecting performance, enter a value
(number of rows) in this field to limit the number of rows returned. This is similar to using the TOP clause
in SQL.
If you do limit rows, you may not see a record you are expecting. Instead of entering a value here, consider
adding or adjusting criteria to your BAQ to make it more efficient.

6. Now in the BAQ Query Timeout field, enter how many seconds can elapse before the application server
stops the query.
By entering a value in this field, you define how long each BAQ is allowed to run. When a query attempts
to generate results and reaches this time limit, the application server stops the query and sends the user a
time out message.
The default value is 0, indicating there is no limit. By entering 900, you allow queries to run 15 minutes
before they time out.

When you change the above application server settings,


you will cause the application server to restart. Be sure to
change these settings during a period of the day when
few users are logged into the Epicor application.

200 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. Within the Standard Logging information, select the BAQ Logging check box to record Business Activity
Query (BAQ) database calls.
Each time user activity activates a BAQ, the application server log records which query was called and how
long it took this BAQ to gather the data results.
By selecting this check box, you enable the following trace flag in the trace.config configuration file:
<add uri="trace://ice/fw/DynamicQuery" />
As a result, the server log records the following information:

Node Description
QueryID Displays a BAQ ID.
CompanyID A company, under which the BAQ is executed.
SQLExecTime Time spent on executing query's SQL statement on an SQL server.
DataFetchTime Time in milliseconds spent on reading result from an SQL Server and
preparing Result dataset.
PagingMethod If paging is used, displays the name of a paging method. (Simple, Partition,
Offset, Auto)
PageNumber If paging is used, displays the number of requested page.
PageSize If paging is used, displays the size of a page.
TotalTime Total time in milliseconds spent on query processing, including
preparation, execution, fetching data and finalization.
TotalRows Displays the number of rows in a result set.
RowLimitReached Presented if BAQ Query Max Result Rows setting is enabled in Application
Server Settings. If a query result set hits this limit; this node displays the
current limit setting value.

Example

<Op Utc="2013-08-15T08:48:28.9994569Z" act="Ice:BO:DynamicQuery/DynamicQuer


ySvcContract/Execute" dur="20.9593" cli="fe80::35a2:7247:6cab:d0e9%11:53737
" usr="manager" tid="17" pid="11176">
<BAQ QueryID="udfield" />
<BAQ Company="EPIC03" />
<BAQ SQLExecTime="12.2756" />
<BAQ DataFetchTime="3.0597" />
<BAQ PagingMethod="Simple" />
<BAQ PageNumber="1" />
<BAQ PageSize="2" />
<BAQ TotalTime="19.4385" />
<BAQ TotalRows="2" />
</Op>

You can evaluate the server log using the Performance


and Diagnostic Tool. For more information on how to test
the performance of your system, review the Performance
Diagnostic Guide.

8. Click Apply to confirm you changes.

10.2.700 201
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

BAQ Info Zones

A BAQ (Business Activity Query) info zone is an embedded query you can link to a specific field on a program
interface. When you activate a BAQ info zone, it displays as a linked tooltip window. The data that populates
this window depends on both the business activity query and the current value, if any, within the linked field.
After you create or modify the BAQ to use for the BAQ info zone, you link the BAQ to a specific field by either
using Extended Property Maintenance or embedding the BAQ info zone in a customization. When you launch
the program that contains the customized field, you see a BAQ info zone indicator on the field. You can then
modify the color used to display this indicator and define a shortcut key combination that activates the BAQ
zone. You define these personalization features in the Options window; you can access this window from the
Tools menu.

Activate a BAQ Zone

To activate a BAQ zone:

1. If a field is linked to a BAQ zone, a zone indicator displays next to the field.

2. Hold your mouse over the zone indicator; a tooltip window displays.

202 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. This BAQ zone window populates with data. The BAQ zone uses both the query and the field value, if any,
to generate its data results. In this example, the Part Number field has a zone indicator that displays a
graphic file for the selected part (1032KNUT).

For more information about creating BAQ zones, review


the Epicor ICE User Experience and Customization Guide.
The Customization Utilities chapter contains a BAQ Zones
section that describes how to create and customize
program interfaces to display these zones.

BAQ Field Security

Business Activity Queries honor existing Field Security settings.


Some of the database table fields can be censored, meaning that their value is either partly or fully unavailable
to the current user due to the applied field security settings. Access to a field can be denied to a user, Security
Group, or even to the whole Company. Fields are also classified as censored if data masking is applied. In both
cases, access to field data is either prohibited or restricted.
A Business Activity Query (BAQ) returns null values for the fields that are not available to the current user. This
rule also applies to censored fields that are referenced by calculated fields or selected as display fields in a subquery.
A BAQ returns masked values for the fields with enabled data masking.
A BAQ fails to execute if the censored fields are used in a top-level query or a subquery for:
• Defining table or subquery criteria - for example, if a filter condition is applied to a censored field or a
calculated field that references a censored field in a table from the top-level query or a subquery.
• Establishing relations - for example, if a censored field or a calculated field that references a censored field
is used for creating a relationship between tables or subqueries on a top-level query or subquery level.

BAQ Best Practices

This section contains a series of best practice methods to help you develop BAQs. If you follow these suggestions,
you will have more success creating both display-only and updatable BAQs.
Fewer Tables, Better Performance
Carefully consider how many tables you need to join in your business activity query. The functionality has few
restrictions, so, if you wish, you can create incredibly complex queries. The more tables you join on the query,
however, the slower performance the query has during runtime.
If you wish to see a lot of data at once, create a series of smaller BAQs and then display them together on the
same dashboard. If you need to create a very complex view of your data, however, consider building an executive
dashboard instead. Both the dashboard and executive dashboard features use BAQs as building blocks for
gathering and displaying data, but contain additional, more efficient functionality for publishing and subscribing
values between tables. Because of this, it is often better to have a series of smaller BAQs you can manipulate
through a dashboard, rather than one huge BAQ that requires a lot of processing time to pull in its data.
To learn more, review Chapter 5: Dashboards and Chapter 7: Executive Dashboards.
Start Small and Test Often

10.2.700 203
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Begin your complex query project by starting small with just one or two tables. You can then analyze the results
to find out if you are pulling in the desired data at each step through the database. You can then add more
complexity by adding another table and testing the results. By adding and testing each table and subquery, you
verify the results as you build the complex BAQ. Always be sure to build a complex BAQ in sections and then
frequently check the results. If you do not, you may pull in undesirable data, and it will be difficult for you to
determine which table is causing the problem.
Too Much Data
If you are getting more rows in your results than you expect, you may need to filter the second, using a field on
the first table. For example, you want to create a BAQ that shows when a specific operation is scheduled to run.
Because the database contains operations scheduled as What-If operations and others scheduled as actual
operations, you may get duplicate results. If you filter the JobOperDtl (job operation detail) table by using the
ResourceID field on the ResourceTimeUsed table, only resources assigned to operations in the actual schedule
appear in your BAQ results.
Use Calculated Fields
If you have similar data placed in different columns because of different record types, use a calculated field to
total these amounts for display within a single column. For example, if you are creating a query to review labor
in your manufacturing center, each employee will log time as indirect labor and direct labor. To find out the total
amount of labor, use a calculated field that contains a formula for totaling the indirect and direct labor values.
Outer Joins – When to Use
The Outer Join table relationship is useful in situations where you want to see everything from the first table and
find out what records are not linked to these records in the second table. For example, you want to see which
customers have recently ordered products from your company. To do this, you build a query that outer joins the
Customer table with the OrderHed (sales order header) table. All the customer records appear alongside all of
the sales order records. You can then see in the BAQ the customers that currently do not have sales orders placed
with your company.
Sorting Performance
Sorting data by a selected column is a powerful feature, but be aware that some significant processing time may
be required to display the reordered results. This situation is especially true when you sort a large amount of
data. The query tool has to first return all of the records into memory before it can re-order their sequence through
the selected column. All of this processing occurs on the server, so the data calls need to move across the network
before they arrive at your client workstation. So if you sort on a large amount of data, be patient – the reordered
results are on their way.

Case Studies

This section of the chapter explores some step-by-step case studies. Each case study explores a different aspect
of the business activity query (BAQ) functionality.

Labor Summary BAQ

This BAQ generates a summary of each shop employee’s total labor and burden hours. During this case study,
you join the Employee Basic (EmpBasic) table from Shop Employee Maintenance with the Labor Detail (LaborDtl)
table from Labor Entry. You then filter the results against a specific date and create calculated fields to generate
the total labor and burden hours.

204 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Define the Query

To define the query:

1. Click New.

2. In the Query ID field, enter EMPHours.

3. In the Description field, enter Labor Summary.

4. Select the Shared check box to indicate other users within the current company can use this query.

5. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 205
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. In the Filtering field, enter emp.

7. The Erp.EmpBasic table displays. Drag and drop it onto the grid.

8. Click the Connected Only Tables button. This limits the tables so that only tables linked to the EmpBasic
table display on this list.

206 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. The Erp.LaborDtl table displays. Drag and drop it onto the grid. The two tables automatically link.

10. You want to filter the labor data based on a cutoff payroll date. Highlight the Erp.LaborDtl table.

10.2.700 207
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. The Table Criteria sheet automatically displays.

12. Click New. A row displays in the Criteria grid.

13. From the Field list, select PayrollDate.

14. From the Operation list, select Greater Than or Equal (>=).

15. From the Filter Value list, select the specified constant option.

16. Click the specified word.

17. The Specify a Value window displays. In the Value field, enter the date you need.

18. Click OK.

19. On the Standard toolbar, click Save.

Select and Create Columns for Display

Select the columns on both the tables you want to view in your results.

1. Navigate to the Display Fields > Column Select sheet. Use this sheet to define what columns display on
the query results.

208 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the Sort Columns Alphabetically button.

3. Expand the EmpBasic node and move Name into the Display Column(s) area.

4. Select the Group By check box to group BAQ results by each employee.

5. Add two calculated fields to the query results. Click the Calculator button.

6. The Calculated Field Editor window displays.

10.2.700 209
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Click New.

8. In the Field Name field, enter LaborHrs.

9. From the Data Type list, select decimal. This indicates the field accepts decimal places within its values.

10. You are creating a calculated field that totals each employee’s labor hours. In the Functions area, expand
the Aggregate node.

11. Select the Sum(x) option. Notice the function syntax displays in the Editor field. This function adds together
all values the query finds in a specific column. In this query, it totals the labor hour values linked to each
shop employee record.

12. In the Fields area, expand the LaborDtl node and double-click LaborHrs.

13. Click Save.

14. Repeat these steps to create another calculated field that totals burden values for each shop employee. Use
the Sum(x) function and select the BurdenHrs field.

15. Click Save.

16. Close the Calculated Field Editor.

17. Notice your calculated fields are included within the Display Column(s) section. If you wish, click inside the
Label column to modify the text that displays for each column.

210 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

18. You are ready to test the query. Navigate to the Analyze sheet.

10.2.700 211
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

19. Click the Test button.

Because you created calculated fields, the total labor and burden hours for each employee displays in the Query
Results grid.

Not Clocked Out BAQ

This BAQ displays all the employees who are currently clocked in but not clocked out on operations. During this
case study, you join the Labor Head (LaborHed) table to the shop employee (EmpBasic) table, and then filter the
results by employees that still have an active labor transaction running within the database. You also sort the
results by employee.

212 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Define the Query

To define the query:

1. On the Standard toolbar, click New.

2. In the Query ID field, enter NoClockOut.

3. In the Description field, enter Employees Not Clocked Out.

4. Select the Shared check box to indicate other users within the current company can use this query.

5. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 213
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Search for and place the Erp.LaborHed and Erp.EmpBasic tables on the canvas.

7. These tables have a relation defined in the schema, so they automatically link.

8. You want to filter the employee data based on the employees who are still clocked into the application.
Highlight the Erp.LaborHed table.

9. The Table Criteria sheet automatically displays.

10. Click New. A row appears in the Criteria grid.

214 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

11. From the Field list, select ActiveTrans.

12. From the Operation list, select Equal To (=).

13. From the Filter Value list, select the specified constant option.

14. Click the specified word.

15. The Specify Value window displays. In the Value field, enter Yes. This indicates only employees who are
currently clocked in display in this query.

16. Click OK.

Select Columns for Display

Select the columns on both the tables you want to view in your results.

1. Navigate to the Display Fields > Column Select sheet.

10.2.700 215
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the Sort Columns Alphabetically button.

3. Expand the EmpBasic node.

4. Move the following columns from the Available Columns area to the Display Column(s) area:
• EmpBasic_Name
• EmpBasic_EmpID

5. Expand the LaborHed node.

6. Move the following columns from the Available Columns area to the Display Column(s) area:
• LaborHed_ActualClockinDate
• LaborHed_ActualClockInTime
• LaborHed_ActualClockOutTime
• LaborHed_ActLunchInTime
• LaborHed_ActLunchOutTime
• LaborHed_ActiveTrans

7. Navigate to the Display Fields > Sort Order sheet.

216 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

8. You want the results to sort by each employee’s name. Expand the EmpBasic node.

9. Move EmpBasic.Name to the Sort By column.

10. Click Save.

11. You are ready to test the query. Navigate to the Analyze sheet.

10.2.700 217
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. Click the Test button.

All the employees who are currently clocked into the database display in the Query Results grid.

Simple Updatable BAQ

This case study demonstrates how to create a simple updatable query to create or update supplier records.

Define the Query


To define the query:

1. Click New to create a new query.

218 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. In the Query ID field, enter Supplier.

3. In the Description field, enter Supplier Update.

4. Select the Shared and Updatable check boxes.

5. Navigate to the Query Builder > Phrase Build sheet.

6. In the Filtering field, enter ven.

10.2.700 219
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Select Erp.Vendor table and move it on the designer canvas.

8. Navigate to the Display Fields > Column Select sheet.

9. Expand the Vendor table to display the fields.

10. Move the following fields into the Display Column(s) section and change the field labels as follows:
• Vendor_Company
• Vendor_VendorID
• Vendor_Name
• Vendor_VendorNum
• Vendor_Address1
• Vendor_City
• Vendor_State
• Vendor_ZIP
• Vendor_Country

Define Basic Processing Details

1. Navigate to the Update > General Properties sheet.

220 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Verify the Allow New Record check box is selected.

3. Select the Allow Multiple Row Update check box.

4. Click the Updatable column header check box to mark all fields in the grid as updatable.

5. Navigate to the Update > Update Processing sheet.

10.2.700 221
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Click the BPM Update option.

7. Click the Business Object button.


The Select Business Object window displays.

8. In the Suggested business objects section, select the Erp.Vendor object and click OK.

9. In the Tables to update pane, ensure the Vendor table is becomes selected.

10. Click Save.

Update and Create Supplier Records

1. Click the Get List button to test whether the updatable BAQ can pull in data from the database.

222 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. You are warned this test may launch BPM directives that update the database. Click Yes.

3. The Query Results grid populates with data. You now can test the BAQ to find out if you can update
existing records.

10.2.700 223
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. In the Query Results grid, double-click on a row.

5. The Fields window displays. This window contains all of the fields you indicated were updatable on the
Update > General Properties sheet. In the Fields window, enter a new value in one of the fields.
In this example, you modify the address of a supplier record.

6. Click OK to exit the Fields window.

7. The record you updated is now highlighted within the Query Results sheet.

224 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

8. If you want to save this change to the database, click the Update button.

9. The record is now updated. To verify the update to the database was successful, click the Get List button
again to retrieve the updated DB results. You can also open a specific program that should reflect your
changes, for example, Supplier Maintenance and verify your changes there.

10. If you want to add new records to the updatable BAQ, click the Get New button.

This option is only available when you select the Allow


New Record check box on the Update > General Properties
sheet.

11. A blank row displays on the Query Results list. Double-click the empty row.

10.2.700 225
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. The Fields window displays. Initially, all the fields are blank Enter the values you need to create a new record.
In this example, you create a new supplier record.

13. In the Fields window, click OK.

14. On the last row of the Query Results grid, the new record displays.

226 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. If you want to save this change to the database, click the Update button.

16. The new supplier record is now created. To verify the update to the database was successful, click the Get
List button again to retrieve the updated DB results.

If uBAQ supports Multiple Row Update set on the Update


> General Properties, then several rows can be edited
before clicking Update button. Otherwise - only one row
can be edited.

10.2.700 227
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Advanced Updatable BAQ

In this case study, design an updatable query to view and update sales order header data.
Throughout this example, explore various tools such as client-server tracing, raising BPM events using updatable
columns and calling Business Object methods from within BPM directives. You also understand the concept of
using directive level variables, to pass and receive data from Business Object calls.

Create New BAQ

1. Click New to create a new query.

2. In the Query ID field, enter SOHeaderUpdate and press Tab.

228 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. In the Description field, enter Sales Order Header Update.

4. Select the Shared, All Companies and Updatable check boxes.


These value indicate the query allows data entries, it's definition is visible to another companies within the
database and is available to other users within the current company.

5. Select the Query Builder > Phrase Build tab.

6. Search for and place the following tables on the designer canvas:
• Erp.OrderHed
• Erp.Customer
• Erp.ShipTo

7. Now specify relationships between the tables. Accept the default relationship between the Erp.OrderHed
and Erp.Customer tables.

8. When the Ship To customer is selected on the order header, you want to display the information directly
from the Ship To table. To do so, first delete the relationship between the Erp.Customer and Erp.ShipTo
tables.

9. Now click the Add Connection icon.

10.2.700 229
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

10. Create a link between the Erp.OrderHed and Erp.ShipTo tables.

11. Select the newly created link between the two tables.

230 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

12. On the Table Relationships pane, create new relationship between the two tables using the following
fields:

OrderHed field or any expression ShipTo field or any expression


Company Company
CustNum CustNum
ShipToNum ShipToNum

Select Display Columns


In this task, select the fields you want to display on the query.
Before you start designing a BAQ, it is a good practise to familiarize with the database schema and fields you
want to include in the query. To do so, you can use the Field Help feature - a quick reference tool that provides
a brief field description and the technical property reference for selected fields.

1. Navigate to the Display Fields > Column Select sheet.

10.2.700 231
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Select the following fields in this order and move them to the list of Display Column(s).
To easily locate the below fields, you can sort columns alphabetically.

• OrderHed_Company
• OrderHed_OrderNum
• Customer_CustID
• Customer_Name
• Customer_Address1
• Customer_Address2
• Customer_City
• Customer_State
• Customer_Zip
• OrderHed_CustNum
• OrderHed_BTCustNum
• OrderHed_ShipToCustNum
• OrderHed_PONum
• OrderHed_ShipToNum
• ShipTo_Name

232 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

• ShipTo_Address1
• ShipTo_Address2
• ShipTo_City
• ShipTo_State
• ShipTo_Zip
• OrderHed_NeedByDate
• OrderHed_RequestDate
• OrderHed_FOB
• OrderHed_ShipViaCode
• OrderHed_TermsCode
• OrderHed_DiscountPercent

3. Notice the Customer and Ship To table fields share the same labels. In order to distinguish between them
on a dashboard, modify the Ship To field labels in the following way:

Alias Label
ShipTo_Name ShipTo Name
ShipTo_Address1 ShipTo Address
ShipTo_Address2 ShipTo Address2
ShipTo_City ShipTo City
ShipTo_State ShipTo State/Prov
ShipTo_Zip ShipTo Postal Code

Select Updatable Fields


Select the fields you want to update through this query.

1. Navigate to the Update > General Properties sheet.

10.2.700 233
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Verify the Allow New Record check box is automatically selected.


This function allows creation of new order header records through this updatable BAQ.

3. In the Label For Add New field, enter New Order.


This optional value defines what displays on the drop-down menu next to the New button on the Standard
toolbar. The text you enter here displays as a node on this drop-down menu.

4. Now specify for which fields you want to allow data updates by selecting the Updatable check box. In this
example, select the following fields:
• Customer_CustID
• OrderHed_CustNum
• OrderHed_BTCustNum
• OrderHed_ShipToCustNum
• OrderHed_PONum
• OrderHed_ShipToNum
• OrderHed_NeedByDate
• OrderHed_RequestDate

234 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

• OrderHed_FOB
• OrderHed_ShipViaCode
• OrderHed_TermsCode
• OrderHed_DiscountPercent

Specify Update Processing Method


Now specify which method to use for database updates. In this example, use the special Business Object method
named UpdateExt to update the database. This method simulates the standard way of how Epicor ERP application
manipulates data within Business objects.

1. Navigate to the Update > Update Processing sheet.

2. Verify the BPM Update Processing method is selected by default.

3. Click the Business Object button.

4. On the Select Business Object window, the application suggests several Business Objects you can use to
perform database updates.

5. From the list, select Erp.SalesOrder.

6. Click OK to close the window.

7. At the bottom, notice the Query To Object Column Mapping sheet. This sheet defines how data is pulled
from the uBAQ to the Business Object table.

Notice that by default, BO table columns are populated


through query results of an internal ttResults table. For
example, query results of the ttResult.OrderHed_CustNum
field populate data in the OrderHed_CustNum field.

10.2.700 235
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. The Object To Query Column Mapping sheet defines the opposite mapping, it specifies how data is
returned to the BAQ from the Business Object.

9. Save the query.

Analyze Tracing Log


In this task, launch the Sales Order Entry form and find out which Business Object methods are called, when
certain updates are made on the form. You will later configure the query to replicate the same behavior.
First, use the Tracing Options window to set up a tracing log that captures all the calls that the user interface
(client) makes to the application server. When you activate this log, any business logic calls sent to the server are
automatically recorded within this log.
Navigate to Sales Order Entry.
Menu Path: Sales Management > Order Management > General Operations > Order Entry
The CRM menu path is: Customer Relationship Management > Order Management > General Operations >
Order Entry

1. First, investigate what happens when you enter a customer ID on the form. Click New > New Order.

236 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. In the Customer field, enter Addison and press Tab.


Notice that certain changes happened on the form. The client has made a call to the server and verified the
customer Dalton exists. The business logic also determined what customer number is linked to that Customer
ID and eventually, it brought back the default information for that customer such as Sold To address, Ship
To address, Ship Via, Terms Code and so on.

3. To analyze the client - server activity, launch the Tracing Options Form. In this example:
• If you use the application with the Modern Home Page style, launch the Tracing Options Form from
the Application Bar at the bottom of the Home Page.

10.2.700 237
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

• If you use the application with the Kinetic Home Page style, launch the Tracing Options Form by selecting
Tracing Options from the overflow menu at the top right corner of the Home Page.

4. On the Tracing Options Form, select the Enable Trace Logging check box.
By selecting this option, all calls made by the user interface to the server now automatically record within
the tracing log.

238 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Click Apply.

6. Navigate back to the Sales Order Entry form. In the Customer field, delete Addison and type Dalton.
Then press Tab.

10.2.700 239
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Navigate back to the Tracing Options Form and click View.

8. The tracing log displays in Notepad.


Notice each method call made from the client is recorded in the <TracePacket> tags. As you analyze the
log, you can ignore the GetRows and GetRowsKeepIdle methods. These methods are system checks
regularly sent to the server by the client.
Verify the following methods were called and review input parameters used by each of the methods.

MethodName Parameters
OnChangeofSoldToCreditCheck
<parameter name="iOrderNum"
type="System.Int32"><![CDATA[0]]></parameter>
<parameter name="iCustID"
type="System.String"><![CDATA[DALTON]]></parameter>
<parameter name="cCreditLimitMessage"
type="System.String"><![CDATA[]]></parameter>
<parameter name="lContinue"
type="System.Boolean"><![CDATA[False]]></parameter>
<parameter name="ds" type="SalesOrderDataSet">

ChangeSoldToID <parameter name="ds" type="SalesOrderDataSet">


ChangeCustomer <parameter name="ds" type="SalesOrderDataSet">

Each Business Object method uses parameters to provide the expected behavior. Notice the above methods
use the same dataset (ds) parameter called SalesOrderDataSet. Later in this workshop, you replicate this
behavior by calling these methods from within a BPM workflow.

240 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Now examine what happens when you change the default ShipTo location. Launch the Tracing Options
Form again and click Clear Log.

10.2.700 241
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

10. Change the ShipTo location to Plant2 and notice the address changes.

11. Switch back to the Tracing Options Form and click View.

242 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

12. In the log, verify the ChangeShipToID method was called. You can ignore other system methods, if present
in the log. Notice the method again uses a single ds (dataset) parameter called SalesOrderDataSet.

MethodName Parameter
ChangeShipToID <parameter name="ds" type="SalesOrderDataSet">

10.2.700 243
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

13. The last process you want to track down is selection of the Need By date and automatic assignment of the
Ship By date. Invoke the Tracing Options Form and Clear Log.

14. In the Need By field, which is OrderHed.NeedByDate, select today's date.

244 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. Notice the Need By date you selected becomes the default Ship By date. This DB field is
OrderHed.RequestDate.
This date is used as the default date for all sales order lines.

16. View the Tracing Log. Verify the method that was called this time was ChangeNeedByDate. This method
uses two parameters - ds (dataset) SalesOrderDataSet and a TableName parameter of string type. Notice
the TableName parameter is set to OrderHed.

MethodName Parameters
ChangeNeedByDate
<parameter name="ds" type="SalesOrderDataSet">
<parameter name="cTableName"
type="System.String"><![CDATA[OrderHed]]></parameter>

10.2.700 245
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

17. On the Tracing Options Form, clear the Enable Trace Logging check box.

18. Click OK.

Use Updatable Field Editor


In this task, define additional properties for selected updatable columns.

1. In BAQ Designer, navigate to the Update > General Properties sheet.

246 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the Advanced Column Editor Configuration... button.

3. The Updatable Field Editor window displays.

10.2.700 247
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. Since you want the uBAQ to perform additional actions after values in certain field change, you need to
specify which fields will raise BPM events. In this example, select the Raise Events check box for the following
fields:
• Customer_CustID
• OrderHed_ShipToNum
• OrderHed_NeedByDate

5. For the Terms Code field, you want to allow users to use a drop-down menu and select one of the available
codes customers will pay for an order.
In the left pane, select OrderHed_TermsCode.

6. In the Editor Type field, select Dropdown List.

7. In the Data from field, accept the default option Custom Values.

8. In the Values Editor pane at the bottom, define what values you want to display on the drop-down list.
Use the Add Value icon to create new records.

9. Enter the following data:

Value Display Text Order


1/10 1/10 Net 30 1
2/10 2/10 Net 30 2
COD Cash on Delivery 3

10. Click Save and exit the Updatable Field Editor.

248 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Tour Updatable BAQ Method Directives


In this task, review Business Object methods used by the updatable BAQ.

1. Navigate back to the Update > Update Processing sheet.

2. Click the BPM Directives Configuration button.

3. The Updatable BAQ Method Directives window displays.

10.2.700 249
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. Expand the Methods node.


Note that each Business Objects contains a code that calls a database, sends current data to a custom
dashboard for display, or populates a database with new data. Each Business Object houses the methods
used to enter, view, and calculate data for a specific function within the Epicor application.

Each process a business object can run is called a method;


by default, each updatable BAQ contains the following
methods:
• GetNew - This method generates a new record and
adds it to the database table.
• Update - This method refreshes the information within
the database with new information a user has entered
in the updatable BAQ.
• Get List - This method retrieves the data specified by
the query.
• CustomAction - Use this method to run custom
actions you define on the uBAQ.
• FieldUpdate - This method occurs after the user's
change to a field is committed. You can use this
method to perform additional processing against the
changed row. For example, when you enter a part
number, you want the part description field to
populate automatically.
• FieldValidate - This method occurs before the
proposed change to a field is committed. You can use
this method to validate proposed changes. For

250 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

example, you can prevent users from entering an


incorrect value in a certain field such as non-existent
state.
You can monitor each of these methods through BPM
directives.

5. Based on the information you specified on the BPM Update Processing tab, the BAQ Designer generates
the Base Processing directive against Update method. To see the code automatically generated by uBAQ:

6. Expand Ice.EPIC06/SOHeaderUpdate.Update > Base Processing and click on the directive named
##BASE##.

7. Click the Design button.

8. The BPM Workflow Designer displays.

9. In the workflow, click on the DefaultImpl custom code action.

10. Click on the // <autogenerated> ... link in the Actions pane.

11. The Enter Custom Code window displays. Notice the code governs the update process by preparing data,
specifying which columns were selected as updatable, calling UpdateExt method and so on.

12. Exit the Enter Custom Code window and close the BPM Workflow Designer without saving any changes.

13. In the Methods Tree-view, notice the Base Processing directive was also generated for the GetNew method.
This directive was generated as you allowed creating new records through this BAQ by selecting the Allow

10.2.700 251
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

New Record option on the Update > General Properties sheet. This directive is also named #BASE# name
and it contains a C# code with field assignments for new rows.

It is important to understand that when you use the BPM


Update processing method to perform uBAQ updates,
you should not modify the auto-generated #BASE#
directives. Once the query is saved in the BAQ Designer,
these directives are automatically recompiled and any
changes made to them are discarded.
If you need to customize the directive generated by BPM
Update processing, use the Advanced BPM Update
processing method.

Create New Directive


In this task, start building a new Base Processing directive for the FieldUpdate method. Recall this method is
used when you need to perform additional processing against a modified row.

1. In the Updatable BAQ Method Directives window, select the FieldUpdate method.

252 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. From the New menu, select New Base Processing.

You should always create Base Processing directives for


any updatable query methods you want to call.

3. For Directive Name, enter ColumnEvents.

4. Click Design to launch the BPM Workflow Designer.

10.2.700 253
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. When you build a complex updatable query, a common practise is to test if BPM is able to identify a certain
event was called. This can be done as follows.
In the BPM Workflow Designer, place the Show Message action on the surface below the Start item.

6. Connect Start to Show Message.

7. Select the Show Message action and click designed.

8. In the Message Template window, in the Name field, enter Test.

9. Delete the default text in the Editor pane and enter Field Name =.

10. Click Insert.

11. From the context menu, select Parameter > fieldName.

12. Click OK to exit the window.

254 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. Click Save and Exit to close the Designer.

14. Click the Enable check box to activate the directive.

10.2.700 255
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

15. Save the record.

16. Exit Updatable BAQ Method Directives.

Test Events
Now verify raising of BPM events works.

1. In the BAQ Designer, navigate to the Analyze sheet.

256 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the Get List button to retrieve the existing data.

3. Double-click on any existing row to launch the Fields window. This window contains all of the fields you
indicated were updatable.

4. Notice, that for Customer_CustID, OrderHed_ShipToNum and OrderHed_NeedByDate fields that were
selected to raise BPM events, two additional buttons display. The V button performs the FieldValidate BAQ
method directives; the U button performs the FieldUpdate BAQ method directives described for the field.

These two buttons only display in the BAQ Designer.


When the BAQ is used on a dashboard, these methods
execute automatically.

5. To verify raising of events works, in the Customer_CustID field, enter a customer other than current. For
example, enter Dalton, Addison or Barriston.

6. Click U to fire the FieldUpdate method.

7. Notice the Information Message displays and the field that raised the event, in this case, Customer_CustID
is identified.
You will later use this logic to create several branches within the BPM workflow based on which field called
an event.

8. Click OK to the message and close any other potential messages reported by the method.

10.2.700 257
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

9. Exit the Fields Window.

10. Navigate back to the Workflow Designer. On the Update > Update Processing sheet and click the BPM
Directives Configuration button.

11. Select the ColumnEvents directive.

12. Click Design to launch the BPM Workflow Designer.

258 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. Since you verified raising of events works, delete the Show Message action.
Remain in the workflow.

Configure Customer ID Condition


In this task, start building a workflow branch that simulates the process when Customer ID is changed on the
Sales Order Header.

1. First, you need to make sure certain actions are performed only when a CustomerID is changed. To do so,
place the Conditon element below the Start item. Leave an extra space between the Condition and the
Start for another workflow item created later in the process.

10.2.700 259
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Now configure the Condition. In the pane at the bottom, click New and select the pre-built condition
statement:
The specified argument/variable is equal to the specified expression

3. Click the first specified.

4. Select the fieldName argument.

5. Confirm your selection by clicking OK.

6. Click the second specified parameter.

7. In the Specify C# Expression window, enter "Customer_CustID".

8. Click OK to close the Editor.

9. In order to quickly identify the purpose of each workflow item, you can customize it's name. Double-click
the Condition name heading and type Cust ID?.

260 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Configure BO Call
By analyzing the Sales Order tracing log, you found out that three methods - OnChangeofSoldToCreditCheck,
ChangeSoldToId and ChangeCustomer are called when a CustomerID is changed. Revisit the Analyze Tracing
Log topic, if needed. Now call these methods from within the workflow. Start the process by configuring the
OnChangeofSoldToCreditCheck method.

1. Place the Invoke BO Method action below the Cust ID? Condition. This action is found in the Callers
category.

2. The action statement reads:


Invoke specified BO method with specified parameters
Click the first specified to launch the Choose BO Method window.

10.2.700 261
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. For Business Object, select Sales Order.

4. Search for and select the OnChangeofSoldToCreditCheck method.

5. Click the second specified to launch the Setup Method Parameters window.

6. Notice the two in (input) parameters pass data into the method. These are required parameters the method
call expects. In both cases, you will supply this data from the internal ttResults table the uBAQ uses.

7. For the iOrderNum parameter, invoke the Binding drop-down list and select expr: specified expression.

8. Click the link to launch the launch the Specify C# expression window. Use this window to compose an
expression assigned to this parameter.

262 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Expand the Temp-tables > ttResults node.

10. Double-click on the OrderHed_OrderNum field. Verify the Editor pane now reads
ttResultsRow.OrderHed_OrderNum.

11. Click OK to exit the Specify C# expression window.

12. Similarly, create another expression for the iCustID parameter and set it to ttResultsRow.Customer_CustID.

10.2.700 263
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

13. Now specify the two out (output) parameters which return data from the method call. Business Object
methods do not require any data from the parameters of this direction.
In this example, for both the cCreditLimitMessage and IContinue parameters, select [ignore].

14. Notice the last parameter of this method named ds (dataset). This parameter uses the INPUT-OUTPUT
direction, which indicates the method receives data from this parameter and potentially returns the updated
data into the variable of the same type. Also, notice the required type is SalesOrderTableSet.

It is important to understand that this variable of TableSet


type is not available in the uBAQ at this moment.
Therefore, you need to create a new variable of this type,
so it becomes available for use within the current directive.

15. For the ds SaledOrderTableSet parameter, click Binding and select create new variable.

16. In the Create new variable window, notice the type of variable required by the Sales Order BO defaults
in. In this case, the type is Erp.Tablesets.SalesOrderTableset.
For Name, enter SalesOrderTS.

17. Click OK in both Create New Variable and Setup Method Parameters windows.

18. To identify which method is called through this action, change the Invoke BO Method heading to Credit
Check.

264 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Fill TableSet Variable


At this stage, the newly created SalesOrderTS variable is empty and no data is prepared for the Business Object
method call. To add data into the directive-level variable of Tableset type, use the Fill Table By Query workflow
action.

1. In this example, the TableSet variable prepares data for all Business Object Methods used across the workflow.
Click the Fill Table By Query action and place it right below the Start item.

2. In the Actions pane, view the statement:


Use the designed query to insert data into the specified table with specified
mapping

3. First, design a BPM query. Click designed to launch the Compose Query window.

4. For Query Name, enter FillSOTableSet.

10.2.700 265
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. When you construct the query, you can reference both in-memory tables, known by the Business Object,
such as ttResults and standard database tables such as ERP.OrderHed.
As data is currently in the ttResults table, place this table on the canvas.

6. To finalize the query, click the Display Fields tab and select the columns you want to display in the result
set.

266 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. Select the following columns:


• OrderHed_Company
• OrderHed_OrderNum
• Customer_CustID
• OrderHed_CustNum
• OrderHed_BTCustNum
• OrderHed_ShipToCustNum
• OrderHed_PONum
• OrderHed_ShipToNum
• OrderHed_NeedByDate
• OrderHed_RequestDate
• OrderHed_FOB
• OrderHed_ShipViaCode
• OrderHed_TermsCode
• OrderHed_DiscountPercent
• RowMod

At the bottom of the record, all temp tables contain a


column called RowMod. This column defines if a record
has been Added, Updated, Changed, or Deleted.

10.2.700 267
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. In the Compose Query window, click OK.

9. Now select the target in-memory table where data from the BPM Query will be inserted. In this example,
you select the directive level variable of the TableSet type you created for this directive.
In the Action phrase, click specified.

10. From the Table drop-down list, scroll down and select SalesOrderTS.OrderHed.

11. Click OK to close the Select Table window.

12. To complete the action, configure how records are mapped to the in-memory table.
Click the specified mapping link.

268 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. The Setup Table Mapping window displays, presenting all fields available within the SalesOrderTS.OrderHed
variable.

14. Click the Bind Automatically button. As the result, BPM Query display fields with the matching name and
type are automatically mapped to the corresponding target table columns.

15. In the Setup Table Mapping window, click OK.

16. Connect Start to Fill Table By Query.

10.2.700 269
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

17. Connect Fill Table By Query to the CustID ? condition.

18. Connect the Cust ID ? condition to Credit Check action.

The directive-level variable is now ready for use within the workflow.

Add Remaining Customer Change Methods


Incorporate two additional methods that are called when a CustomerID is changed on the Sales Order Entry form
- ChangeSoldToID and ChangeCustomer.

1. First, configure the ChangeSoldToID method. Place the Invoke BO Method action below the Credit Check
action.

270 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Click the first specified to launch the Choose BO Method window.

3. Search for and select the Erp.SalesOrder.ChangeSoldToID method.

4. Click OK to exit the Choose BO Method dialog.

5. Click specified to launch the Setup Method Parameters window.

10.2.700 271
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Notice this method uses a single parameter of SalesOrderTableset type. Click Binding and select the previously
created var: SalesOrderTS variable.

7. Click OK to exit the Setup Method Parameters window.

8. Change the Invoke BO Method action heading to Change Sold To.

272 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Similarly, configure the ChangeCustomer method. Place the Invoke BO Method action below the Change
Sold To action.

10. Click the first specified to launch the Choose BO Method window.

11. Search for and select the Erp.SalesOrder.ChangeCustomer method.

12. Click OK to exit the Choose BO Method dialog.

13. Click specified to launch the Setup Method Parameters window.

10.2.700 273
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

14. Same as above, this method uses a single parameter of SalesOrderTableset type. Bind this parameter to the
var: SalesOrderTS variable.

15. Click OK to exit the Setup Method Parameters window.

16. Change the Invoke BO Method action heading to Change Customer.

274 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

17. Connect the Credit Check action to Change Sold To.

18. Connect the Change Sold To action to Change Customer.

Update ttResults Table


Recall that the purpose of the Fill table by Query action is to create new rows in the SalesOrderTS.OrderHed
variable. To complete the workflow, you need to get these modified rows back from the variable and update
the existing rows in the internal ttResults table. Also, recall the query results of the ttResult table eventually update
the BO's OrderHed table. This way, the updated data becomes available for display and use by the client.
To update the existing ttResult table rows, use the Update Table By Query action:

1. Place the Update Table By Query action below and to the right of the Change Customer method call
action.

10.2.700 275
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. In the Actions pane, view the statement:


Use the designed query to update all rows of specified table with specified
mapping

3. Design a BPM query. You can then use the query rows to update the information within a target table. Click
designed to launch the Compose Query window.

4. For Query Name, enter UpdateResults.

276 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. As modified data is currently in SalesOrderTS.OrderHed table, place this table on the canvas.

6. You also need to retrieve data back from two additional tables used on the query. Place the following tables
on the canvas:
• Erp.Customer
• Erp.ShipTo

7. Delete the automatic link between the Erp.Customer and Erp.ShipTo tables.

8. Manually create the relationship between the SalesOrderTS.OrderHed and Erp.Customer tables using
the following fields:

SalesOrderTS_OrderHed field Customer field


Company Company
CustNum CustNum

10.2.700 277
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

9. Create new relationship between the SalesOrderTS.OrderHed and Erp.ShipTo tables using the following
fields:

SalesOrderTS_OrderHed field Ship To field


Company Company
CustNum CustNum
ShipToNum ShipToNum

278 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. Click the Display Fields tab and select the following columns to be included in the result set:
• SalesOrderTS_OrderHed_Company
• SalesOrderTS_OrderHed_OrderNum
• SalesOrderTS_OrderHed_CustNum
• SalesOrderTS_OrderHed_PONum
• SalesOrderTS_OrderHed_ShipToNum
• SalesOrderTS_OrderHed_RequestDate
• SalesOrderTS_OrderHed_FOB
• SalesOrderTS_OrderHed_ShipViaCode
• SalesOrderTS_OrderHed_TermsCode
• SalesOrderTS_OrderHed_DiscountPercent
• SalesOrderTS_OrderHed_NeedByDate
• SalesOrderTS_OrderHed_BTCustNum
• SalesOrderTS_OrderHed_ShipToCustNum
• Customer_CustID
• Customer_Name
• Customer_Address1
• Customer_Address2
• Customer_City
• Customer_State
• Customer_Zip

10.2.700 279
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

• ShipTo_Name
• ShipTo_Address1
• ShipTo_Address2
• ShipTo_City
• ShipTo_State
• ShipTo_Zip

11. Click OK to close the Compose Query window.

12. Now select the target in-memory table where data from the BPM Query will be inserted. In the Action phrase,
click specified.

280 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. From the Table drop-down list, verify ttResults (queryResultDataSet.Results) defaults in.

14. Click OK to close the window.

15. Now configure how records are mapped to the ttResults table. Click the specified mapping link.

10.2.700 281
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

16. Click the Bind Automatically button to map fields from the variable to the results table.

17. In the Setup Table Mapping window, click OK to close it.

18. Change the action heading to Update ttResults.

282 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

19. Connect the Change Customer method call action to Update ttResults.

Build ShipTo Change Workflow Branch


In this task, build a workflow branch that simulates change of ShipTo location on the Sales Order Entry form.

1. First, make sure this workflow branch executes when the ShipTo number is changed. To do so, place the
Conditon element to the right of the Cust ID? condition.

10.2.700 283
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Select the pre-built condition statement:


The specified argument/variable is equal to the specified expression

3. Click the first specified parameter and select fieldName.

4. Confirm your selection by clicking OK.

5. Click the second specified parameter.

284 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. In the Specify C# Expression window, enter "OrderHed_ShipToNum".

7. Click OK.

8. Change the condition heading to Ship To?.

9. Connect the Cust ID? False exit point to the Ship To? condition.

10. Recall the method you need to use to replicate the behavior is ChangeShipToID. Place the Invoke BO
Method action below the Ship To? condition.

11. Click the first specified to launch the Choose BO Method window.

12. Search for and select the Erp.SalesOrder.ChangeShipToID method.

13. Click the specified to launch the Setup Method Parameters window.

10.2.700 285
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

14. For a single parameter used by the method, click Binding and select the previously created SalesOrderTS
variable.

15. Click OK to exit the Setup Method Parameters window.

16. Change the Invoke BO Method action heading to Change Ship To.

286 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

17. Connect the Ship To? True exit point to the Change Ship To action.

18. Again, you need to send data from the SalesOrderTS variable to the ttResults table. To do so, connect the
Change Ship To action to Update ttResults.

Build Ship By Date Assignment Workflow Branch


In this task, build the last workflow branch that handles assignment of a Ship By date, when a Need By date is
selected.

1. Create another condition to check if the Need By date field is updated on the form. Place the Conditon
element below and to the right of the Ship To? condition. Configure the Condition as follows:

2. Select the pre-built condition statement:


The specified argument/variable is equal to the specified expression

3. Click the first specified parameter.

4. In the Select an Argument/Variable window, select fieldName.

5. Confirm your selection by clicking OK.

6. Click the second specified parameter.

10.2.700 287
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. In the Specify C# Expression window, enter "OrderHed_NeedByDate" and confirm.

8. Change the condition heading to Need By?.

9. Connect the Ship To? False exit point to the Need By? condition.

288 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. Recall the method that gets called is ChangeNeedByDate. Place the Invoke BO Method action below the
Need By? condition.

11. Click the first specified to launch the Choose BO Method window.

12. Search for and select the Erp.SalesOrder.ChangeNeedByDate method.

13. Click specified to launch the Setup Method Parameters window.

10.2.700 289
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

14. For the ds (dataset) parameter used by the method, click Binding and select the previously created
SalesOrderTS variable.

15. For the iTableName parameter, invoke the Binding drop-down list and select expr: specified expression.
Recall this parameter requires the OrderHed table name passed in. Create a C# expression; in the Editor
pane, enter "OrderHed".

16. Now that both parameters are configured, click OK to exit the Setup Method Parameters window.

290 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

17. Change the Invoke BO Method action heading to Change Need By.

18. Connect the Need By? True exit point to the Change Need By action.

19. Send data from the SalesOrderTS variable to the ttResults table. To do so, connect the Change Need By
action to Update ttResults.

Complete the Directive

1. The workflow is now ready for testing. Click Save and Exit to close the BPM Workflow Designer.

10.2.700 291
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Save the directive.

292 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. Exit Updatable BAQ Method Directives.

Test BAQ Results


In this task, verify the query works as expected.

1. In the BAQ Designer, select the Analyze tab.

2. Click the Get List button and verify the query retrieves existing order headers.

3. Now test raising of events. Click Get New.

4. Double-click the empty row at the bottom of the Query Results grid to invoke the Fields window.

5. In the Customer_CustID field, enter Dalton and press Tab.

10.2.700 293
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Click the U (update) button to call Field Update event.

7. Verify the operation completes successfully. To the message, click OK.

8. Notice the default information for the customer Dalton, such as Customer Number, Ship To location and
Terms Code default in.
Now test raising of another event. In the OrderHed_NeedByDate field, select today's date.

294 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Click the U button and verify the OrderHed_RequestDate automatically fills in.

10. Close the Fields window by clicking OK.

11. Now test if you can create the new sales order record. Click Update and verify the operation succeeds.

10.2.700 295
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. Lastly, test the Ship To location change. Click Get List and double-click the new order line to invoke the
Fields window.

296 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. In the OrderHed_ShipToNum field, enter a non-existent ShipTo location. For example, enter Plant123.

14. Click the U button and verify the Invalid Ship To error message displays.

15. Now enter a valid ShipTo location for the customer Dalton by changing the value to Plant2.

10.2.700 297
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

16. Click the U button and verify the Field Update operation completes successfully.

17. Exit the Fields window and notice the ShipTo address on the grid is changed.

298 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

18. Save the query.

The query is now ready for users, for example, on a dashboard.


This case study demonstrates how you can create or update a sales order header record using a BAQ. However,
you can apply the same process on any other action, for example, to update sales order lines.
Try to avoid building very complex updatable queries that simulate each and every action a user performs on
a smart client form. Instead, try to make your BAQs simple and understandable to your users.
Also, it is often better to have a series of smaller BAQs you can manipulate through a dashboard, rather than
one huge BAQ that requires a lot of processing time to pull in its data.

Using Inner SubQueries

In this case study, create a BAQ that counts open, closed, and total amount of orders per customer. Create two
SubQueries that count open and closed orders and group them together by customer. The information obtained
by the Inner SubQueries is presented by the TopLevel SubQuery.

Create Open Orders SubQuery


The first SubQuery you create counts open orders by customer.

1. Click New.

10.2.700 299
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. In the Query ID field, enter OrderCount.

3. In the Description field, enter Order Count per Customer.

4. Select the Shared check box.

5. Navigate to the Query Builder > Phrase Build sheet.

6. In the filtering field, enter ord.

300 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. From the list, select the Erp.OrderHed table and drag and drop it onto the canvas in the center pane.

8. Verify the Table Criteria sheet at the bottom is in focus.

9. Click New.

10. From the Field list, select OpenOrder.

11. In the Operation column, verify Equal To (=) defaults.

12. From the Filter Value list, select the specified constant option.

13. Click the word specified.


The Specify Value window displays.

14. In the Value field, enter True and click OK.


This limits the query selection to open orders.

Select Columns

1. Navigate to the Display Fields > Column Select sheet.

2. Expand the OrderHed node.

3. Double-click CustNum to add the OrderHed_CustNum field to the list of Display Column(s).

4. Select the Group By check box to indicate you want to group open orders by customer.

5. Click the Calculator icon.

10.2.700 301
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

The Calculated Field Editor window displays.

6. In the Field Name field, enter CountOpen and press Tab.

7. From the Data Type list, select int.

8. In the Functions area, expand the Aggregate node.

9. From the Aggregate listing, select Count(x).


Selecting the function displays the function syntax in the Editor field. In this query, the field counts the
amount of open orders.

10. To indicate you want to count all open order records, inside the brackets, enter * (asterisk).

11. Verify the Editor pane displays the following:


count( * )

12. Click Save and exit the Calculated Field Editor.

13. Navigate to the Query Builder > SubQuery Options sheet.

14. For SubQuery1 you just created, from the Type list, select InnerSubQuery.
This indicates this SubQuery becomes a nested query inside the TopLevel BAQ you create later.

302 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. Click Save.

Create Closed Orders SubQuery


The second SubQuery you create counts closed orders by customer.

1. On the Active SubQuery toolbar, click Add Subquery.

2. On the Query Builder > SubQuery Options sheet, accept the following defaults:

Name Type
SubQuery2 InnerSubQuery

3. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 303
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. In the filtering field, enter ord.

5. From the list, select the Erp.OrderHed table and drag and drop it onto the canvas in the center pane.

6. In the Specify Table Alias window, click OK.

The BAQ Designer must create the table alias for the
OrderHed table since it is already used in the previous
SubQuery.

7. Verify the Table Criteria sheet at the bottom is in focus.

8. Click New.

9. From the Field list, select OpenOrder.

10. In the Operation column, verify Equal To (=) defaults.

11. From the Filter Value list, select the specified constant option.

12. Click the word specified.


The Specify Value window displays.

13. In the Value field, enter False and click OK.


This limits the query selection to closed orders.

304 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Select Columns

1. Navigate to the Display Fields > Column Select sheet.

2. Expand the OrderHed1 node.

3. Select CustNum to add OrderHed1_CustNum to the list of Display Column(s).

4. Select the Group By check box to indicate you want to group closed orders by customer.

5. Click the Calculator icon.

6. Click New.

7. In the Field Name field, enter CountClosed and press Tab.

8. From the Data Type list, select int.

9. In the Editor pane, manually add the calculation that counts all closed orders.
count( * )

10. Click Save and exit the Calculated Field Editor.

Create TopLevel SubQuery


Create the main SubQuery that displays the BAQ results using both inner SubQueries.

1. On the Active SubQuery toolbar, click Add Subquery.

2. Navigate to the Query Builder > SubQuery Options sheet.

3. For SubQuery3, from the Type list, select TopLevel.

10.2.700 305
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. Navigate to the Query Builder > Phrase Build sheet.

5. Search for and add the Erp.Customer table onto the canvas in the center pane.

6. Click the SubQueries button to display the list of available SubQueries.

7. Drag and drop both SubQuery1 and SubQuery2 onto the canvas.

8. Click the Add Connection (chain links) icon.


The cursor turns into a cross-hair.

9. Click the Erp.Customer table and drag a line to the SubQuery1 table, then release.

10. Verify the Table Relations sheet at the bottom displays.

306 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

If not, select the sheet.

11. Click the Add Row button.

12. From the Customer field or any expression list, select CustNum.

13. From the SubQuery1 field or any expression list, select OrderHed_CustNum.

14. Repeat steps 8 - 13 to create a connection between the Erp.Customer and SubQuery2 tables.

15. Click Save.

Select BAQ Display Columns

1. Navigate to the Display Fields > Column Select sheet.

10.2.700 307
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Expand the Customer node and move the Name field to the list of Display Column(s).

3. Expand the SubQuery1 node and move the Calculated_CountOpen field to the list of Display Column(s).

4. Expand the SubQuery2 node and move the Calculated_CountClosed field to the list of Display Column(s).

5. Click the Calculator icon.


The Calculated Field Editor window displays.

6. In the Field Name field, enter Total and press Tab.

308 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. From the Data Type list, select int.

8. In the Fields pane, expand the Available Tables > SubQuery1 node.

9. Double-click Calculated_CountOpen to add the field to the Editor pane.

10. In the Editor pane, click + (plus).

11. In the Fields pane, expand the Available Tables > SubQuery2 node.

12. Double-click Calculated_CountClosed to add the field to the Editor pane.


Verify the Editor pane displays the following calculation:
SubQuery1.Calculated_CountOpen + SubQuery2.Calculated_CountClosed

13. Click Save and exit the Calculated Field Editor.

Test the BAQ

1. Navigate to the Analyze sheet.

10.2.700 309
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click Test.

The BAQ displays open, closed, and total amount of orders per customer.

Combine Results Sets Using Union

This case study demonstrates how to build a BAQ that displays total value breakdown of sales for a given day.
This BAQ provides information on total values of:
• Quotes entered in the sales pipeline.
• Orders booked in the system.
• Invoices sent to customers.

310 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

You accomplish this task by creating a BAQ comprised of three SubQueries and combining their results into one
dataset.

Create TopLevel BAQ

1. On the Standard toolbar, click New.

2. In the Query ID field, enter SalesValue.

3. In the Description field, enter Total Value of Quotes, Orders, Invoices by Date.

4. Select the Shared check box.

5. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 311
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Drag and drop the following tables onto the designer canvas:
• Erp.QuoteHed
• Erp.Customer

7. Navigate to the Display Fields > Column Select sheet.

312 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

8. Move the following columns to the Display Column(s) list.

Column Name
QuoteHed_Company
Customer_Name
QuoteHed_QuoteNum
QuoteHed_EntryDate

9. For each of the above columns, select the Group By check box.

10. Click the Calculator icon.


The Calculated Field Editor window displays.

11. Click New and enter these field values:

Field Value
Field Name SubQueryName
Data Type nvarchar
Label Document Type
Editor pane 'Quotes'

12. Click Save.

10.2.700 313
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

13. Click New.

14. Enter these field values:

Field Value
Field Name QuoteSum
Data Type decimal
Label Total Value

15. In the Functions area, expand the Aggregate node and double-click Sum(x).

16. In the Fields section, expand the Available tables > QuoteHed node and double-click QuoteAmt.
Verify the Editor displays the following calculation:
sum( QuoteHed.QuoteAmt )

17. Click Save and exit the Calculated Field Editor.

18. Move the Calculated_SubQueryName column up and make it the first column in the list.

314 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

19. Navigate to the Analyze sheet and click Test.


Verify the query returns the list of quotes.

Create Order View SubQuery

1. Navigate to the Query Builder > SubQuery Options sheet.


You first change the name of the TopLevel SubQuery in focus.

10.2.700 315
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. In the Name field, enter QuoteHed.

3. Click Save.

4. On the Active SubQuery toolbar, click Add Subquery.

5. In the Name field, enter OrderHed.

6. From the Type list, select Union.

316 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. Navigate to the Query Builder > Phrase Build sheet and drag and drop the following tables on the designer
canvas:
• Erp.OrderHed
• Erp.Customer

Since the Customer table is already used in the BAQ definition, accept the proposed table alias.

Example
By default, the table name defaults to Customer1.

8. Navigate to the Display Fields > Column Select sheet and move the following columns to the Display
Column(s) list:

Column Name
OrderHed_Company
Customer1_Name
OrderHed_OrderNum
OrderHed_OrderDate

10.2.700 317
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

9. For each of the above columns, select the Group By check box.

10. Click the Calculator icon.


The Calculated Field Editor window displays.

11. Click New and enter these field values:

Field Value
Field Name SubQueryName1
Data Type nvarchar
Label Document Type
Editor pane 'Orders'

318 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

12. Click Save.

13. Click New.

14. Enter these field values:

10.2.700 319
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Field Value
Field Name OrderSum
Data Type decimal
Label Total Value

15. In the Functions pane, expand the Aggregate node and double-click Sum(x).

16. In the Fields pane, expand the Available tables > OrderHed node and double-click OrderAmt.
Verify the Editor pane displays the following calculation:
sum( OrderHed.OrderAmt )

17. Click Save and exit the Calculated Field Editor.

18. Move the Calculated_SubQueryName1 column up and make it the first column in the list.

Recall the number and the order of the columns is the


same as specified in the TopLevel SubQuery.

19. Click Save.

320 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Create Invoice View SubQuery

1. Navigate to the Query Builder > SubQuery Options sheet.

2. On the Active SubQuery toolbar, click Add Subquery.

3. In the Name field, enter InvcHed.

4. In the Type field, select Union.

5. Navigate to the Query Builder > Phrase Build sheet and drag and drop the following tables onto the
designer canvas:
• Erp.InvcHead
• Erp.Customer
Accept the proposed Customer table alias.

6. Navigate to the Display Fields > Column Select sheet and move the following columns to the Display
Column(s) list.

Column Name
InvcHead_Company
Customer2_Name
InvcHead_InvoiceNum
InvcHead_InvoiceDate

7. For each of the above columns, select the Group By check box.

8. Click the Calculator icon.


The Calculated Field Editor window displays.

9. Click New and enter these field values:

Field Value
Field Name SubQueryName2
Data Type nvarchar

10.2.700 321
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Field Value
Label Document Type
Editor pane 'Invoices'

10. Click Save.

11. Click New.

12. Enter these field values:

Field Value
Field Name InvoiceSum
Data Type decimal
Label Total Value

13. In the Functions pane, expand the Aggregate node and double-click Sum(x).

14. In the Fields pane, expand the Available tables > InvcHead node and double-click InvoiceAmt.
Verify the Editor pane displays the following calculation:
sum( InvcHead.InvoiceAmt )

15. Click Save and exit the Calculated Field Editor.

16. Move the Calculated_SubQueryName2 column up and make it the first column in the list.

322 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

17. Click Save.

Create Query Parameter


Create a Query Parameter to filter the data using an alternative parameter value you define. In this example, you
would like to filter results by date. When you launch the BAQ, the parameter value displays for input.

1. From the Actions menu, select Define Parameters.

The Query Parameters window displays.

2. In the Parameter Name field, enter Date.

10.2.700 323
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. From the Data Type list, select date.

4. Accept the default values and click Save.

5. Close the Query Parameters window.


You now define which BAQ fields you want to filter by date.

6. Navigate to the Query Builder > Phrase Build sheet.

7. On the design canvas, click the Erp.InvcHead table.

8. At the bottom of the screen, verify the Table Criteria sheet displays.

324 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Click the Add Row button.

10. From the Field list, select InvoiceDate.

11. In the Operation column, verify Equal To (=) defaults.

12. From the Filter Value list, select the specified parameter option.

13. Click the word specified.


The Select Parameter window displays.

14. Verify the Date parameter you created is highlighted and click Select.

15. Repeat steps 7 - 14 to apply the same filter to the OrderHed and QuoteHed SubQueries. To switch between
SubQueries, use the Active SubQuery toolbar.
Use the table below for reference:

Table Field Operator Filter Value


Erp.OrderHed OrderDate = @Date parameter
Erp.QuoteHed EntryDate = @Date parameter

16. Once finished, click Save.


You can now test the BAQ execution.

Test the BAQ

1. Navigate to the Analyze sheet.

10.2.700 325
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the Test to invoke the Parameters window.

3. Enter the Date for which you want to retrieve records.

4. Click OK.

5. The grid populates with records.

6. Right-click anywhere in the grid and select Show Group By and Show Summaries.

7. Drag the Document Type column to the pane above the grid.

8. In the Total Value header, click the Sigma (∑) icon.

326 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. In the Select Summaries window, select Sum.

10. Click OK.

11. You BAQ results are now broken down by Quotes, Orders, and Invoices with their total values for a given
day.

10.2.700 327
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Advanced Data Aggregation

This case study demonstrates how you can use the advanced Group By expression to view total value of sales
orders and quotes per country and customer.
In order to gather correct aggregate results from more than one table in the query, the following approach is
used:
• Each table combination and aggregate calculation is performed within individual inner SubQueries.
• The whole query results are presented using the Top Level Subquery.

Create Order View SubQuery

1. Create a new Business Activity Query.

2. Select the SubQuery Options sheet.

3. For Type, select InnerSubQuery.

4. Place the Erp.Customer and Erp.OrderHed tables on the canvas.

328 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Accept the default relation between the tables but for the Join Type, select Right Join.
This eliminates customers who have not placed any orders to appear on the list of query results.

6. In this example, a filter is placed on the Customer table to only retrieve records from Mexico and Canada.

10.2.700 329
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. For the Display Column(s), select the Customer_Country and Customer_CustID columns.

330 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

8. Now create a calculated field that summarizes the total amount of orders placed by customers. Click the
Calculated Field Editor button.

9. Click New and for the Field Name, enter TotalOrder.

10.2.700 331
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

10. For Data Type, select decimal.

11. In the Editor pane, create the following calculation to summarize order values:
sum( OrderHed.OrderAmt )

12. Save the record.

13. Access the Advanced Group By Clause Editor by clicking on a button found at the bottom of the screen.

332 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

14. Similar to the Calculated Field Editor, the window contains lists of available fields, functions, and operators.
You can add these items to an expression by either double-clicking them or dragging and dropping them
onto the editor window's Expression Editor field. Click Add Row to create a new expression.

10.2.700 333
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

15. At the top of the Functions node, notice the Group By category displays.
The ROLLUP, CUBE, and GROUPING SETS operators found in this category represent advanced aggregation
extensions of the GROUP BY clause.

Function Description
ROLLUP
The ROLLUP operator is useful in generating reports that contain subtotals and totals. It
generates a result set that shows aggregates for a hierarchy of values in the selected columns.
The resulting SQL syntax may look similar to the following:
SELECT a, b, c, SUM ( <expression> )
FROM T
GROUP BY ROLLUP (a,b,c);
As a result, one row with a subtotal is generated for each unique combination of values of
(a, b, c) , (a, b) , and (a). A grand total row is also calculated.

CUBE
Generates simple GROUP BY aggregate rows, the ROLLUP super-aggregate rows, and
cross-tabulation rows. CUBE outputs a grouping for all permutations of expressions in the
<composite element list>.
The resulting SQL syntax may look similar to the following:
SELECT a, b, c, SUM (<expression>)
FROM T
GROUP BY CUBE (a,b,c);
As a result, one row is produced for each unique combination of values of (a, b, c) , (a, b)
, (a, c) , (b, c) , (a), (b), and (c) with a subtotal for each row and a grand total row.
GROUPING
Specifies multiple groupings of data in one query. Only the specified groups are aggregated
SETS
instead of the full set of aggregations that are generated by CUBE or ROLLUP. The results
are the equivalent of UNION ALL of the specified groups. GROUPING SETS can contain a
single element or a list of elements. GROUPING SETS can specify groupings equivalent to
those returned by ROLLUP or CUBE. The <grouping set item list> can contain ROLLUP or
CUBE.
The resulting SQL syntax may look similar to the following:
SELECT a, b, SUM (<expression>)
FROM T
GROUP BY GROUPING SETS ((a),(b))

For more information on the above operators, review the available Microsoft® documentation, for example:
• http://technet.microsoft.com/en-us/library/bb522495(v=sql.105).aspx
• http://technet.microsoft.com/en-us/library/ms177673.aspx
• http://blogs.msdn.com/b/craigfr/archive/2007/10/11/grouping-sets-in-sql-server-2008.aspx

In this example, expand Functions > Group By and double-click the ROLLUP function. This function
generates an output that presents subtotals and totals.

16. For Group By expression fields, from the Customer table, select Customer.Country and Customer.CustID
fields, separated by a comma.
The Group By expression should now read:
ROLLUP( Customer.Country, Customer.CustID )

334 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

17. Click OK to exit the editor.


The first SubQuery is now prepared.

Create Quote View SubQuery


Similarly, create another SubQuery to display the total value of quotes per country and customer.

1. Navigate to the SubQuery Options sheet, and Add New SubQuery.

2. For Type, select InnerSubQuery.

3. Place the Erp.Customer and Erp.QuoteHed tables on the canvas.

10.2.700 335
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. Accept the default relation between the tables. Same as for orders, for the Join Type, select the Right Join
to eliminate customers for whom no quotes have been created yet.

5. Again, from the Customer table, apply a filter to only retrieve customers from Mexico and Canada.

336 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. Same as before, for the Display Column(s), select the Customer_Country and Customer_CustID columns.
Create another calculated field named Total Quote that summarizes the total amount of quotes placed by
customers. This time, the expression should read:
sum(QuoteHed.QuoteAmt)

10.2.700 337
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

7. Click the Advanced Group By Clause Editor button to aggregate results for this SubQuery.

8. Create the same ROLLUP expression using the Country and Customer ID columns, separated by a comma.
The Group By expression should read:
ROLLUP( Customer1.Country, Customer1.CustID )

338 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

9. Click OK to close the editor.


Now, the second SubQuery is prepared.

Create TopLevel Subquery

1. Navigate to the SubQuery Options sheet, and Add New SubQuery.

10.2.700 339
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. For Type, verify TopLevel displays.

3. This TopLevel SubQuery will display combined results from both previously created SubQueries. Select the
Query Builder > Phrase Build sheet and click the SubQueries button.

340 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

4. Place both inner SubQueries on the canvas.

5. Now it's time to select which fields will be displayed by the query. In this example, values in the Customer
ID and Coutry fields will be constructed using the SQL COALESCE syntax. The expression you create evaluates
the arguments in order and returns the current value of the first expression that initially does not evaluate
to NULL.
Click the Calculated Field Editor button.

10.2.700 341
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Click New and enter a Field Name, for example, Cust ID.

342 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. For Data Type and Format, use the default database attributes for this field - nvarchar x(10).

8. Now enter a label, for example, Customer ID.

9. In the Editor pane, type coalesce (). Inside the brackets, place function arguments. In the Fields pane, search
for and select both Customer ID fields from inner SubQueries. Remember to separate parameters by a
comma. The whole expression should read:
coalesce(SubQuery1.Customer_CustID, SubQuery2.Customer1_CustID)

10. Click New and create another calculated field to display values in the Country column. Make sure the
expression looks as follows:
coalesce(SubQuery1.Customer_Country, SubQuery2.Customer1_Country)

11. Click Save and exit the editor.

12. Now to the list of Display columns, add both calculated fields from inner SubQueries that aggregate total
values of orders and quotes.

10.2.700 343
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

13. One additional step is required when building this query. Create SubQuery criteria to provide equality of
Customer ID and Country fields. Also, you need build separate conditions to make sure SQL null value in
one field is not equal to null value in another field. These null values will appear in total lines produced by
the ROLLUP aggregation.
The criteria for the TopLevel Subquery should look as follows:

344 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

14. Save the Query.

Test the BAQ


The BAQ is now ready for testing.

1. Navigate to the Analyze sheet and click Test.

2. Notice the total values are summarized by each customer (aggregate rows), sub-totals rows for each country
with the grand total value displaying at the bottom.

3. Now let's test how query results change using the GROUPPING SETS operator. In both inner SubQueries,
modify the Group By expression as follows:
GROUPING SETS( Customer.Country,Customer.CustID )

10.2.700 345
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

4. As a result, data is now grouped by sets of customers and countries.

5. Lastly, let's test how BAQ results change when the CUBE function is used to construct the GROUP BY clause.
Modify both expressions as follows:
CUBE( Customer.Country,Customer.CustID )

346 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. Notice the CUBE operator outputs a grouping for all permutations of expressions in the composite element
list.

10.2.700 347
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Intersect and Except SubQuery Type

You can use the UNION, EXCEPT, and INTERSECT operators to combine more than one SELECT statement to
form a single result set. The UNION operator returns all rows. The INTERSECT operator returns all rows that are
in both the result sets. The EXCEPT operator returns the rows that are only in the first result set but not in the
second one.
In the previous case study - Combine Results Sets - you learned how to use the UNION operator to combine
results of multiple SubQueries into a single result set. In this case study, learn how to intersect the results of two
SubQueries and use the EXCEPT operator to retrieve the query result set where data exists in the first SubQuery
and not in the second one.

Create TopLevel BAQ

1. Click New.

2. In the Query ID field, enter CustomerOrders.

3. In the Description field, enter Orders By Customer.

4. Select the Shared check box.

5. Navigate to the Query Builder > Phrase Build sheet.

348 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. Place the following tables on the designer canvas:


• Erp.OrderHed
• Erp.Customer

7. Highlight the Erp.Customer table.

8. The Table Criteria sheet automatically displays.

9. Click Add Row.


A row appears in the Criteria grid

10. Create the following criteria. To set the Filter Value, use the specified constant option.

And/Or ( Not Field Operation Filter Value )


Country = USA constant
Or Country = CANADA constant

11. Navigate to the Display Fields > Column Select sheet.

10.2.700 349
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

12. Move the following columns from the Available Columns area to the Display Column(s) area:
• Customer_CustID
• Customer_Country
• OrderHed_OrderNum

13. Click Save.

14. You are ready to test the query. Navigate to the Analyze sheet.

350 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

15. Click the Test button.

16. In this example, the BAQ returns order records from customers based in the USA or Canada.

Create Intersect SubQuery

1. Navigate to the Query Builder > SubQuery Options sheet.

10.2.700 351
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. On the Active SubQuery toolbar, click Add Subquery.

3. From the Type list, select Intersect.

4. Navigate to the Query Builder > Phrase Build sheet.

352 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Place the following tables on the designer canvas:


• Erp.OrderHed
• Erp.Customer
Accept the new field Aliases of tables already used in the TopLevel SubQuery.

6. Highlight the Erp.Customer table.

7. The Table Criteria sheet automatically displays.

8. Click Add Row.


A row appears in the Criteria grid.

9. Create the following criteria. To set the Filter Value, use the specified constant option.

And/Or ( Not Field Operation Filter Value )


Country = GERMANY constant
Or Country = CANADA constant

10. Navigate to the Display Fields > Column Select sheet.

10.2.700 353
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

11. Move the following columns from the Available Columns area to the Display Column(s) area:
• Customer1_CustID
• Customer1_Country
• OrderHed1_OrderNum

12. Click Save.

13. You are ready to test the query. Navigate to the Analyze sheet.

354 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

14. Click the Test button.

15. In this example, the BAQ returns order records from customers based in Canada.

Use the INTERSECT operator to return only values that


match within both data sets, as shown in the following
illustration.

10.2.700 355
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Use Except SubQuery Type

1. Navigate to the Query Builder > SubQuery Options sheet.

2. For SubQuery2, from the Type list, select Except.

3. Click Save.

4. Now test how the BAQ results change. Navigate to the Analyze sheet.

356 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Click Test.

6. In this example, the BAQ returns 285 order records from customers based in USA.

The SQL EXCEPT operation is used to combine two SELECT


statements and returns rows from the first SELECT
statement that are not returned by the second SELECT

10.2.700 357
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

statement. This means EXCEPT returns only rows not


available in the second SELECT statement.

Common Table Expression Query

A Common Table Expression (CTE) can be thought of as a temporary result set defined within the execution
scope of a single SELECT (or may serve as a SubQuery, instead of SELECT). Returning hierarchical data is a common
use of recursive queries.

Example You can construct a query displaying employees in


an organizational CTE chart.

A CTE query contains three SubQueries in this order:


• Anchor Common Table Expression - This SubQuery is the starting point that acts as the base to enable the
process of recursion in the CTE. It provides the base data for the rest of the process for fetching the data.
• UnionAll SubQuery - This SubQuery references the Anchor Common Table Expression. After the anchor
query executes, the result set is generated by the anchor query as an input for the recursive query and is joined
with the recursive query to generate new results. Then, a new result set is created and is again joined with
the recursive query, and further results are generated. This process continues until all the records are processed,
which means until further joins return no data.
• TopLevel SubQuery - Pulls data from a Common Table Expression and displays BAQ results.

Create CTE SubQuery


In this example, the query result displays the data in a bill of materials scenario in which a parent product has
one or more components, and those components may, in turn, have subcomponents or may be components of
other parents. The BAQ uses a part number as a query parameter.
First, you specify parameters of the anchor CTE query.

1. Click New.

358 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. In the Query ID field, enter IndentBOM.

3. In the Description field, enter BOM Listing.

4. Select the Shared check box.

5. Navigate to the Query Builder > SubQuery Options sheet.

6. From the Type list, select CTE.

7. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 359
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. Place the Erp.PartMtl table onto the canvas in the center pane.

9. Click Save.

Create Query Parameter


Create a Query Parameter to filter the data using an alternative parameter value you define. In this example, you
would like to filter results by part numbers. When you launch the BAQ, the parameter value displays for input.

1. From the Actions menu, select Define Parameters.


The Query Parameters window displays.

2. In the Parameter Name field, enter PartNum.

360 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. From the Data Type list, select nvarchar.

4. In the Format field, enter x(50).

5. Accept the default values and click Save.

6. Close the Query Parameters window.

7. You now define which BAQ fields you want to filter by the parameter you specified. Navigate to the Query
Builder > Phrase Build > SubQuery Criteria sheet.

10.2.700 361
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

8. From the Table list, select PartMtl.

9. From the Field list, select PartNum.

10. In the Operation column, verify the Equal To (=) defaults.

11. From the Filter Value list, select the specified parameter option.

12. Verify the PartNum parameter you created is highlighted and click Select.

13. Click Save.

Select Columns

1. Navigate to the Display Fields > Column Select sheet.

362 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Move the following columns from the Available Columns area to the Display Column(s) area:
• PartMtl_Company
• PartMtl_PartNum
• PartMtl_RevisionNum
• PartMtl_MtlSeq
• PartMtl_MtlPartNum
• PartMtl_QtyPer
• PartMtl_RelatedOperation
• PartMtl_PullAsAsm
• PartMtl_ViewAsAsm
• PartMtl_PlanAsAsm
Now you are ready to build the BOM Level hierarchy calculated field and Indentation calculated field.

3. Click the Calculator icon to display the Calculated Field Editor.

4. Click New.

10.2.700 363
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. In the Field Name field, enter Hierarchy and press Tab.

6. From the Data Type list, select int.

7. In the Label field, enter BOM Level.

8. In the Editor, enter 0.

This is how you establish the start - anchor of the


recursion: parts with BOM Level 0 are on this level.

9. Click New.

364 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. In the Field Name field, enter Ind1 and press Tab.

11. From the Data Type list, select nvarchar.

12. In the Editor pane, enter the following code that calculates the indentation level of subassembly parts:
cast ( substring('........',1 ,(Hierarchy + 1) ) + PartMtl.MtlPartNum
as nvarchar(25))

13. Click Save.


Now you are ready to configure the UnionAll recursive SubQuery.

Define UnionAll SubQuery

1. Navigate to the Query Builder > SubQuery Options sheet.

10.2.700 365
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. On the Active SubQuery toolbar, click Add Subquery.

3. In the Name field, accept the default of SubQuery2.

4. From the Type list, select UnionAll.

5. Navigate to the Query Builder > Phrase Build sheet.

366 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

For SubQuery2, you use the PartMtl table again, but this time you join it with CTE SubQuery1.

6. Place the Erp.PartMtl table and SubQuery1 on the canvas.


Accept the new Aliases the BAQ creates.

7. To switch tables and subqueries, use the buttons above the list of tables.

8. Create a manual connection between the two tables using the Add Connection (chain links) button.

9. Use the following fields to create an inner join between the tables:

SubQuery1 field = PartMtl1 field


PartMtl_MtlPartNum = PartNum
PartMtl_Company = Company

10. Click Save.

Select Columns

1. Navigate to the Display Fields > Column Select sheet.

When using SubQueries of the Union, UnionAll, Intersect,


or Except type, the number and the order of the columns
must be the same in all SubQueries.

2. Move the following columns from the Available Columns area to the Display Column(s) area:
• PartMtl1_Company
• PartMtl1_PartNum
• PartMtl1_RevisionNum

10.2.700 367
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

• PartMtl1_MtlSeq
• PartMtl1_MtlPartNum
• PartMtl1_QtyPer
• PartMtl1_RelatedOperation
• PartMtl1_PullAsAsm
• PartMtl1_ViewAsAsm
• PartMtl1_PlanAsAsm
Now you are ready to build the calculated field to increment the BOM Level hierarchy.

3. Click the Calculator icon to display the Calculated Field Editor.

4. Click New.

5. In the Field Name field, enter Hierarchy2 and press Tab.

6. From the Data Type list, select int.

7. In the Label field, enter BOM Level.

8. In the Editor pane, enter Calculated_Hierarchy + 1.

This is how you increment the hierarchy. As the SubQuery


goes down through the assemblies, each subassembly is
placed on the respective BOM Level.

9. Click New to create another calculated field. The Indentation you create references the UnionAll SubQuery
Aliases. Otherwise, it is similar to the one created within the CTE SubQuery.

368 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. In the Field Name field, enter Ind2 and press Tab.

11. From the Data Type list, select nvarchar.

12. In the Editor pane, enter the following code that calculates the indentation level of subassembly parts.
cast ( substring('........',1 ,(Hierarchy2 + 1) ) + PartMtl1.MtlPartNum
as nvarchar(25))

13. Click Save.


Now you are ready to configure the TopLevel SubQuery.

Create TopLevel SubQuery

1. Navigate to the Query Builder > SubQuery Options sheet.

10.2.700 369
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. On the Active SubQuery toolbar, click Add Subquery.

3. In the Name field, accept the default of SubQuery3.

4. From the Type list, select TopLevel.

5. Navigate to the Query Builder > Phrase Build sheet.

In the TopLevel SubQuery3, you display data from the CTE SubQuery1.

370 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. From the list of SubQueries, select SubQuery1 and place it on the canvas. Accept the new Alias the BAQ
creates.

7. Navigate to the Display Fields > Column Select sheet.

8. Move all the columns from the SubQuery11 to the Display Column(s) area

9. Click Save.
You are now ready to test the query.

Test the BAQ

1. Navigate to the Analyze sheet.

10.2.700 371
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Click the Test to invoke the Parameters window.

3. In this example, in the PartNum field, enter DCD-200-ML.

4. Click OK.

5. The grid populates with data.

372 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

6. To display the hierarchy, group the BAQ results by the BOM Level and Indentation (Ind1) columns.

10.2.700 373
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Now the BAQ results are broken down by levels. The BOM Level 0 displays the parent part - in this case
DCD-200-ML with its subassemblies showing on their respective levels within the Bill of Material.

BAQ Combo

Use this customization tool to create a drop-down list which displays information from a selected business activity
query (BAQ).
After you customize the form and draw the BAQCombo, indicate the specific BAQ and the ValueMember column
which holds the data. You then define the DisplayMember column the customization uses to display the data
during run time on the form.
Note you can create updatable BAQs which allow users to enter data directly into a business object. On the
updatable BAQ, you can define one of the updatable columns to use a BAQCombo. Users can then enter data
through this drop-down list.

Define the Query


Define the source query:

374 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

1. In the Business Activity Query Designer, click the New button.

2. In the Query ID field, enter CustomerParts.

3. In the Description field, enter Parts Listing.

4. Select the Shared check box to indicate other users within the current company can use this query.

5. Click the Query Builder > Phrase Build tab.

10.2.700 375
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Add Erp.OrderDtl and Erp.Customer tables on the designer canvas.

7. Navigate to the Display Fields > Columns Select sheet.

8. Click Calculated Field Editor to add new calculated field.

9. In the Calculated Field Editor, click New. In this example, you create a query that displays the list of customers
and part numbers from the OrderDtl table.

376 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10. In the Field Name field, enter the name of the field, for which you create the calculation. In this example,
enter CustomerPart.

11. From the Data Type drop-down list, select the data type generated by this calculation. In this example,
select nvarchar.

12. Extend the Format field value to display x(60).

13. For the Label, that displays above this calculated field's column header on the BAQ grid, enter Cust Part.

14. In the Editor pane, create the following calculation:


Customer.CustID + ': ' + OrderDtl.PartNum

15. Click Save and exit the editor.

16. Navigate to the Analyze sheet.

10.2.700 377
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

17. Click the Test button and verify the BAQ results.

Customize the Form


In this example, customize the Sales Order Entry form by adding the BAQ Combo.

1. Access the Sales Order Entry with the Developer Mode feature turned on.

378 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. From the Tools menu, select Customization.

3. In the Customization Tools Dialog, from the Tools menu, select Toolbox.

4. From the Toolbox, select BAQCombo.

10.2.700 379
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. Draw the combo inside the form and enter the following information.

6. For the DynamicQueryID, enter the BAQ you created - CustomerParts.

7. Set the DisplayMember property to the column you want to display in the drop-down. In this example,
enter Calculated_CustomerPart.

8. Set the ValueMember property to the column you want to be stored in the Epibinding field you select. In
this example, you again select Calculated_CustomerPart.

Data and display values may be different or the same.

9. Set the AutoWidth property to False.

10. Set the AutoWidthOption property to ControlWidth. This will set the drop-down be the size of the control
- in this case, Calculated_CustomerPart.

11. Set the Epibinding property to the column you want to store data value defined in the ValueMember
property.
In this example, you set a custom field OrderHed.ShortChar01 which was previously added to the data
model.
For more information on how to create user defined fields using Extended User Defined Table Maintenance,
see the Add User Defined Fields topics find in the Customization User Guide.

12. You can also add the EpiLabel to the form to describe the combo you added.

380 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

13. Save the customization and exit the form.

14. Re-open Sales Order Entry using the customization you created.

10.2.700 381
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

15. The BAQ combo now displays all BAQ results. You next configure the BAQ to filter the results based on the
customer selected on the Sales Order header.
For more information on how you can customize the Epicor ERP application, see the Customization User
Guide.

Add the BAQ Markup


For this task, disable the Developer Mode.

1. Navigate back to the Business Activity Query Designer with the CustomerParts query in focus.

382 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. On the Query Builder > Phrase Build sheet, select the Customer table on the canvas.

3. Verify the Table Criteria sheet is selected.

4. Click Add Row.

5. For the criteria Field, select CustID.

6. In the Operation field, verify = (Equals) displays.

7. From the Filter Value drop-down list, select the specified constant option.

8. Click on the specified link to display the Specify a value window.

10.2.700 383
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

9. In the Value field, enter the following:


[EpiBinding:OrderHed.CustomerCustID]

The open and closing brackets "[]" indicate the constant


is using the BAQ Markup Language. You can use the BAQ
Markup Language on the BAQ Criteria to filter on dynamic
values based on the context where the BAQ is being
consumed. Using the BAQ Markup syntax, you can add
criteria to a BAQ that will be substituted at runtime.
In general, the Markup syntax looks as follows:
[Token:Value].
The Token attribute within the brackets defines the type
of replacement to perform, and the value can be either:
• Like - For example you can use
[Like:Customer.CustID] syntax to find the first data
column of the currently selected data view that has
the matching Like value. Typically, use this markup
when the BAQ will be re-used on several UIApps where
the Like value will be found.
• EpiBinding - For example, you can use [EpiBinding:
OrderHed.CustomerCustID] syntax to find the data
value of the currently selected row of the data view
and column described by the EpiBinding. Typically, use
this markup when the BAQ will be used on a specific
UIApp where the EpiBinding is known.
• Current Value - This option is primarily used for
InfoZone BAQs, where the InfoZone was added to a
UI control that is "unbound". As a result of being
unbound, the data value is not accessible via either of
the previous two options. When you need to retrieve
a value from an unbound control and use it for an
InfoZone BAQ criteria, use the [Current:Value] syntax.
The second Value, separated from the first using the
colon ":", describes either the Like value, the actual
EpiBinding string, or the Current Value.
In this example, at runtime, the value from
OrderHed.CustomerCustID will replace this markup string
in the BAQ criteria.

10. Click OK.

11. The BAQ is now complete. Save and exit the query.

384 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Test the Results

1. Activate the Developer Mode and launch the customized Sales Order Entry form again.

2. Search for and select a collection of orders by several customers.

3. As you navigate and change rows, the combo is re-filtered by the current customer.

10.2.700 385
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

Another way of using BAQ combos are parent/child user-defined tables, for example UD100 and UD100A.
For example, you can use the EpiRetrieverCombo to select the data from the parent table and bind that
data to a specific table column (Epibinding). You can then use a BAQ Combo and use the Epibinding
markup syntax to filter the query results using the value selected in the EpiRetrieverCombo. For more
information, review the User-Defined Tables topics in the Customization User Guide.

Transforming Legacy First/Last Table Modifiers

This topic discusses how to modify a legacy BAQ utilizing First or Last table modifiers to make it compatible with
E10 syntax.
In previous Epicor 9 version, you can use the following table modifiers to control which data is retrieved from
each table:
• Each – All the rows of data within this table are pulled into the query; these rows are not sorted.
• First – Only the first row of the linked table that matches the criteria is returned.
• Last – Only the last row of the linked table that matches the criteria is returned.
When importing or migrating a legacy BAQ having First/Last modifiers into Epicor ERP version 10, adjustments
in BAQ Designer are needed in order to get the same results.
Typically, the same query results can be accomplished by using:
• If First/Last table modifier was used on the parent (first) table in E9, then this behaviour can be accomplished
by sorting data (Asc, Desc) and using the TOP N clause in the Toplevel Subquery

386 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

• If First/Last table modifier was used on any subsequent (child table), then this behaviour can be accomplished
in two ways:
• If you want to retrieve one or more fields from a table, create a SubQuery with parent-child tables. Add
column sorting and use the TOP N clause to retrieve number of rows of your choice. You then add reference
fields into Subquery's display fields.
• If you want to retrieve a single field from a table, create a SubQuery with a child table. Add Group By
fields involved in relation between parent and child tables. You then add a Calculated field with Min/Max
function against a field to determine the First/Last record you want to retrieve. You then reference this
field in the SubQuery's display fields.

The above techniques are discussed in the following examples.

Example 1
The below legacy query returns the list of all customer along with their latest sales order numbers recorded in
the system. Notice the last table modifier placed on the OrderHed table retrieves the most recent order number.
As the left outer join is used to define relationship between tables, the BAQ also displays customers who have
not yet placed an order.

The BAQ output looks as follows:

10.2.700 387
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

This method shows how to retrieve a single record using the Calculated Field. To get the same results in Epicor
ERP 10:

1. Create a TopLevel SubQuery and place the ErpCustomer table on the canvas.

388 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

2. Create another SubQuery of InnerSubQuery type and place the OrderHed table (child table) on the canvas.

10.2.700 389
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. Add Group By fields you will use in relation between parent and child tables.

4. Create a Calculated Field to retrieve the maximum sales order number.

390 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

5. Switch to the TopLevel SubQuery and place the SubQuery2 on the canvas.

10.2.700 391
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Create relationship between the tables.

7. Select TopLevel SubQuery Display Columns.

8. Verify the BAQ results.

392 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

Example 2
The below legacy query returns the most recent part revision for the selected part. Notice the last table modifier
placed on the PartRev table retrieves the latest revision.

10.2.700 393
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

The BAQ output looks as follows:

394 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

In this example, learn how to get the same BAQ results in Epicor ERP 10 by sorting data and using the SQL TOP
N clause:

1. In the TopLevel SubQuery, place the Erp.Part table on the canvas and apply the table filter.

10.2.700 395
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. Create another SubQuery of InnerSubQuery type. Place the Erp.Part and Erp.PartRev tables on the canvas.

396 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

3. For the Erp.Part table, create identical Table Criteria as in the TopLevel SubQuery.

4. Select Inner SubQuery display columns you will later use to create relationships and display data in the
TopLevel SubQuery.

5. Sort Inner SubQuery data by the RevisionNum column in the descending order. This puts the latest revision
at the top of query results.

10.2.700 397
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. Now define the SELECT TOP clause and specify you want to return a single row.

398 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

7. Switch to the TopLevel SubQuery and place the SubQuery2 on the canvas.

8. Create relationship between the tables.

9. Select TopLevel SubQuery display columns.

10.2.700 399
Chapter 1 | Business Activity Queries Epicor ICE 3.2 Tools User Guide

10. Click Test and verify the BAQ results.

400 10.2.700
Epicor ICE 3.2 Tools User Guide Business Activity Queries | Chapter 1

10.2.700 401
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

Chapter 2: External Business Activity Queries

Use the External Query functionality to create a connection to external (non-Epicor) data sources. This feature is based
on accessing external data via ODBC connections and provides the mechanism for retrieving, updating and displaying
information from an external database using the SQL language. Working with external data source looks similar to
ordinal query design and execution. The data you retrieve using the external query can be used in additional dashboard
renderings, like dashboard applications, mobile framework, Epicor Sharepoint Publisher and so on.
To use the functionality, you need an ODBC connection to an external server configured on the machine where the
application server is hosted. This connection must also be specified when you create the query. Through the External
BAQ Designer, you can browse and select tables from an external data source in the same way as when data is pulled
from the Epicor database.
The process of creating an external BAQ involves the following:
• Establish a connection to an external datasource using the ADO .NET DB provider available on the machine and
compose a connection string to access the external database management system.
• Set up security restrictions to schema and data coming from an external datasource.
• Modify external datasource metadata specified in the source database as required.
• Enable the external datasource you create in the company you work with.
• Build an external Business Activity Query and use it as a datasource for reports, dashboards, trackers and so on.
• Expose the data to users using the Epicor Everywhere™ Framework tools.
This chapter describes how to set up and configure connection to an external datasource. The process of building a
query is nearly identical to ordinal BAQ design. For more information on how to construct a query, see the Business
Activity Queries chapter.

External Datasource Type Maintenance

Use External Datasource Type Maintenance to set up security restrictions to schema and data from an external
datasource.
On the Data Filtering, you can set up restrictions to limit the data displayed by the query. You can create a
single criterion that pulls in the data you need. You can also create a combined criteria by linking your criterion
with And or Or statements.

Example You can create a datasource type to only display


records for a specific company. Typically, you can use data
filtering to prevent users from accessing particular data.

On the Schema Filtering sheets, you can apply a filter on a schema level by selecting which tables and columns
you want to display in External Business Activity Query Designer.

Example To narrow down the datasource output you can set


up the datasource type to display tables for a specific schema
name or hide all columns starting with a specific string.
This way, you can prevent users from accessing sensitive data,
such as financial operations and so on.

402 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

Create New Datasource Type


Here's how you can create a new datasource type:
Navigate to External Datasource Type Maintenance.
Menu Path: System Management > External Business Activity Query > External Datasource Types

This program is not available in Epicor Web Access.

1. Click New.

2. In the Datasource Type field, enter a unique identifier of a datasource type.

3. The Application Type field is used to control any specific logic or flow that is related to specific applications
associated with the datasources.
• Generic - Use this default option to create a datasource type for any type of target databases. Using
this type, the whole communication between the application and external data source is performed using
the .ADO.Net datasource.
• Prophet21 - Use this option when you integrate the Epicor ICE framework with Prophet 21(P21)
application.
• Eclipse - Use this option when you integrate the Epicor ICE framework with Epicor Eclipse application.
• iScala - Use this option when you integrate the Epicor ICE framework with Epicor iScala application.

The Epicor ICE (Internet Component Environment) is the


software framework for Epicor ERP software (both as
integrated with the Epicor ERP product and as the
standalone ICE Extend platform for other Epicor products).

4. In the Description field, enter a brief text to describe the purpose of the datasource type.

5. The Owning Company displays the company inside which the current DataSource Type was created. You
cannot change this value; only users within the Owning Company can modify this record.

6. Click Save.

Datasource type records are available for use in all


companies within an on-premise installation. For

10.2.700 403
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

Multi-Tenant installation (Saas solutions), datasource types


are available to all companies within a Tenancy.

Create New Filter Group

The first step to filter data coming from an external datasource is to create a new security group.

1. Navigate to the Detail > Data Filtering sheet.

2. Click New Group.

3. In the FilterGroupName field, enter a unique name for the security group.

Example Company_ID

4. In the Description field, enter a brief description of the security group.

Add New Definition

The below steps discuss how to create a filter to limit the data the external datasource displays through BAQ.
To complete the data filtering:

1. On the Detail > Data Filtering sheet, in the lower pane, click the New Filter button.
A new row displays on the grid.

404 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

2. In the FilterName field, enter a name for the definition or accept the default value.

Example Filter1.

3. In the TableName field, enter a name of the table used in the criterion.
You can accept the default value of --any table --, which means that any table within the datasource should
be checked for some field. It is also possible to use wildcard characters to limit the list of tables used to filter
the data.

4. In the FieldName field, enter a name of the field the rule will valuate.

Example Company_id

5. In the DefaultConstant field, select a BAQ constant from the drop down list or manually enter the constant
value.

Example
• BAQ constants - CurrentCompany, CurrentUserID
• Manually entered constants - "Company1", "True"

10.2.700 405
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. When you need to apply a filter based on the values of more than one criterion, use the And/Or field to
define the criteria string clause.

7. If you want this criterion to evaluate a Not criterion value, select the Not check box.

Example a column NOT IsNull

8. If needed, use the Left Parenthesis and Right Parenthesis fields () to insert parenthesis to the clause.

9. If you want to change the sequence through which filters run, highlight a filter on the grid and click either
the Move Up or Move Down buttons.

10. When you finish building the criterion, click Save.

Apply Table Filter

The below steps discuss how to limit which tables display for selection when you design a new query using BAQ
Designer.
To apply a filter on the table level:

1. Navigate to the Schema Filtering > Table Filtering sheet.

2. Click New Table Filter.


A new row displays on the grid.

3. In the SchemaName field, enter a name of the database schema used in the criterion.
You can accept the default value of --any schema -- to display or hide tables for any schema within the
selected datasource. It is also possible to use wildcard characters to limit the list of schemas used in the filter.

Example dbo, ice%

406 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

4. In the TableName field, enter a value to limit which tables become available for selection creating a BAQ
using the datasource.
You can accept the default value of --any table --, to apply a filter on all tables within the selected database
schema. It is also possible to use wildcard characters to limit the list of tables used to filter the data.

Example You can decide to only display tables for a


specific schema, for example, dbo. Another example
would be to hide tables due to security restrictions, for
example to apply a filter on all tables starting with fin%,
gl%, ap% and so on.

5. When you need to apply a filter based on the values of more than one criterion, use the And/Or field to
define the criteria string clause.

6. If you want this criterion to evaluate a Not criterion value, select the Not check box.

7. If needed, use the Left Parenthesis and Right Parenthesis () fields to insert parenthesis to the clause.

8. If you want to change the sequence through which filters run, highlight a filter on the grid and click either
the Move Up or Move Down buttons.

Apply Column Filter


The below steps discuss how to limit which rows of the external table(s) display for selection when you design a
new query using BAQ Designer.

1. Navigate to the Schema Filtering > Column Filtering sheet.

2. Click New Column Filter.


A new row displays on the grid.

10.2.700 407
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

3. In the SchemaName field, enter a name of the database schema used in the criterion.
You can accept the default value of --any schema -- to display or hide selected tables and columns for any
schema within the selected datasource. It is also possible to use wildcard characters to limit the list of schemas
used in the filter.

Example dbo, ice%

4. In the TableName field, enter a value to limit which tables and respective fields become available for
selection.
You can accept the default value of --any table --, to apply a filter on schema or column level only. To limit
tables and respective fields from displaying in BAQ Designer, you can use SQL Server wildcard characters,
such as % or _ (underscore).

5. In the FieldName field, enter a value to limit which columns become available for selection in BAQ Designer.
To limit certain fields from displaying in BAQ Designer, you can use SQL Server wildcard characters, such as
% or _ (underscore).

Example You can hide a bank account number field for


all tables that exist in the external datasource.

6. When you need to apply a filter based on the values of more than one criterion, use the And/Or field to
define the criteria string clause.

7. If you want this criterion to evaluate a Not criterion value, select the Not check box.

8. If needed, use the Left Parenthesis and Right Parenthesis () fields to insert parenthesis to the clause.

9. If you want to change the sequence through which filters run, highlight a filter on the grid and click either
the Move Up or Move Down buttons.

External Datasource Maintenance

Use External Datasource Maintenance to create a connection to an external database management system.
When you create a new datasource, first specify a datasource name, concise description and select an available
DataSource Type. Datasource types are created in External DataSource Type Maintenance. You can use
datasource type to apply security restrictions to schema and data.
To connect to an external datasource, you must compose a connection string. First, select one of the ADO.Net
providers available on the server. ADO.NET is the .NET technology; an object-oriented set of libraries for interacting
with data sources. There are several data providers you can use to communicate with different data sources. To
create a data source using the iScala datasource type, selecting of ADO.Net provider is disabled, you only create
a connection on the Distribution tab.

Any custom ADO.Net provider can be installed on the server


and used to create a Business Activity Query (BAQ). Each .NET
Framework data provider that supports a factory-based class
registers configuration information is stored in the

408 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

DbProviderFactories section of the machine.config file on


the local computer.

Example The following displays the SQL client data provider


reference in the machine.config file:

<system.data>
<DbProviderFactories>
<add name="SqlClient Data Provider"
invariant="System.Data.SqlClient"
description=".Net Framework Data Provider for SqlServer"
type="System.Data.SqlClient.SqlClientFactory, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
</DbProviderFactories>
</system.data>
The following table outlines some of the data providers you can use to query an external database:

Description
.NET Framework data provider

.NET Framework Data Provider for SQL Provides data access for Microsoft SQL Server version 7.0 or later.
Server Uses the System.Data.SqlClient namespace.
.NET Framework Data Provider for OLE DB For data sources exposed by using OLE DB (Object Linking and
Embedding Database). It uses the System.Data.OleDb namespace.
.NET Framework Data Provider for ODBC For data sources exposed by using ODBC (Open Database
Connectivity). It uses the System.Data.Odbc namespace.
.NET Framework Data Provider for Oracle The .NET Framework Data Provider for Oracle supports Oracle client
software version 8.1.7 and later, and uses the
System.Data.OracleClient namespace.

Create an External Datasource


Navigate to External Datasource Maintenance.
Menu Path: System Management > External Business Activity Query > External Datasources

This program is not available in Epicor Web Access.

1. Click New.

10.2.700 409
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. In the Datasource field, enter a unique identifier that best describes the external datasource.

3. In the Description field, enter a description of the external datasource.

4. In the Datasource Type field, select a type you wish to use in your external datasource.
Datasource types are created in External DataSource Type Maintenance. You can use datasource type to
describe security restrictions applied to schema and data from an external datasource.

5. The Owning Company field displays the company in which the current external datasource was created.
This value displays in a read-only format.

6. In the ADO. Net provider field, select a provider available on the server.
A provider you select is used for connecting to a database, executing commands, and retrieving results. In
this example, SqlClient Data Provider is selected.

For iScala integration this button is disabled, as this type


of integration uses the WCF Service. You set up
connection parameters with iScala exclusively on the
Distribution sheet.

7. For OleDB, ODBC and SQL providers, build the connection string by entering adapter properties on the
Key properties tab.
For the remaining ADO. Net providers, build the connection string using the DB Connection and Advanced
Properties tabs.

410 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

8. In this example, first enter a Data Source; specify a server name and instance name.

9. Then specify an Initial catalog (DB name) you want to connect to.

10. If you want to connect to an external datasource using the Windows security, set the Integrated Security
property to True. This means the credentials of the account running the Epicor Application Pool are used
for authentication. If the account does not have required permissions to access the SQL Server database,
use the SQL Server credentials to log in.

11. If you want to connect to the database using server credentials, enter a valid User ID and Password.

12. Note that for security purposes, the information about the current password is not exposed to any user.

13. Apart from the default connection parameters offered by the selected .NET provider, the following Epicor
specific keys are available for use when building a connection string.

Key Example Description


SimpleSQL=False This property controls how SQL statement is generated by the BAQ engine. Data
providers vary by SQL language dialect they understand. BAQ engine was
developed to work with MS SQL Server and uses features absent in simple data
providers, like MS Access. Typically, set this field to True, if data provider reports
problems understanding SQL instructions.
SkipLoadErrors=True; Sets NULL for the value that cannot be loaded in the field (such as zero-date for
Oracle, as conversion of 0 to date is not supported by .Net)
AliasMaxLength=30; Sets the maximum possible length of field aliases.
UseFieldAlias=True; When used, field aliases will match field names. Standard way of building aliases
using tableid_fieldname format will be suppressed. If duplicate alias entries
occur, digits in ascending order will be placed at the end of aliases.
SqlDialect=Oracle; When used, this parameter is primarily used by the ODBC provider to build SQL
query according to target relational database management system (RDBMS)
syntax. The available values include: Oracle, MySql and Mssql2000.

14. When setting up connection parameters, on the Advanced Properties sheet you can specify detailed
properties for Windows supported .NET providers, such as ODBC, OLE DB and SQL client. The list of driver
properties vary based on selected ADP. NET provider. For more information on specific driver properties,
refer to the Microsoft® Developer Network at http://msdn.microsoft.com/en-US/.

10.2.700 411
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

15. The Connection string pane contains initialization information that is passed as a parameter from a data
provider to a data source. The syntax depends on the data provider, and the connection string is parsed
during the attempt to open a connection.

412 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

16. Use the Test Connection button to verify the connection to an external datasource is successful.

Use the Distribution sheet


Use the Distribution sheet to configure the token server settings required to establish connection between Epicor
ICE and external system's framework. On this sheet you can also restrict how external business activity queries
generate results.

This sheet is only enabled, if an external datasource is


configured to use an iScala, Eclipse or Prophet 21 Datasource
Type.

To configure the external system:

10.2.700 413
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

1. Select the Distribution sheet.

2. The External System pane fields vary based on the selected Datasource Type.

3. In the iScala Server field, enter the full domain name of the iScala server (or the name for which https
binding of IIS hosting iScala WCF services is configured).
For Prophet 21 and Eclipse integration this field displays the Token server URL field. Enter the URL of the
server that validates calls from ICE framework against external application.

4. For Client ID, enter the user name to be used by BAQ engine to authenticate in external system.

5. In the Client secret field, enter the password configured in external system for the above user.

For more information on how to integrate Epicor ICE with


external systems, review the available ICE Extend
documentation found on EpicWeb.

6. After you enter the Username and account password, you can select how to impersonate the user:
• never
• always
• always; fail if not associated

Impersonation mode Description


never The query is executed using default iScala user independent of Epicor user and
Domain and Username fields settings.
always BAQ Engine transfers information from Domain and Username of the current
Epicor user to iScala. If one or both fields are not filled or mapping from the
transferred current Epicor user to iScala internal user is not found, the query is
executed using default iScala user.

414 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

Impersonation mode Description


always; fail, if not BAQ Engine transfers information from Doamin and Username fields of the current
associated Epicor user to iScala. If one or both fields are not filled or mapping from the
transferred current Epicor user to iScala internal user is not found, the error occurs
and the query is not executed.

By default, for datasources, created in previous versions,


never mode is selected. By default, for new datasources
always mode is selected.

7. You can set the maximum number of rows the external query is allowed to return. To do so, enter a value
in the Query Maximum Row Count field.

Example You limit the query to return maximum of 500


rows.

8. The Query Execution TimeOut (Sec) value specifies the longest time (in seconds) in which a query can
run, when executed by the datasource in focus. Specifying 0 for this option indicates all queries are allowed
to run indefinitely.

Example By entering 180 in the field you indicate the


database server may attempt to execute queries for
maximum of 3 minutes. After this period the process is
terminated and the user launching the query receives an
error message.

Query Limits apply to all external queries executed by the


selected datasource regardless of the Datasource Type it
uses.

Export Datasources

Use the Export Datasources functionality to make your external datasources available to users at another
location.
When you export a datasource as a .baqds file, users outside your network can then import this definition onto
their client machines and establish connection to an external datasource. You can also use this functionality to
archive your datasource definition.
To export datasources:

1. Search for and select datasource(s) you want to export.

10.2.700 415
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

2. From the Actions menu, click Export Datasources.

3. By default, all selected datasources, related datasource types and company settings are selected for export.

4. You can customize the exports list using the check boxes that display next each item.

5. Click Export to File.

6. Enter a File name and select a location of the exported *.baqds file.

7. Click Export.

8. View the Export process messages pane and verify the process is complete.

9. Click Close.
The exported datasource(s) definition is now available to other users.

416 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

Import Datasources

Use the Import Datasources functionality to import previously exported datasources and datasource types into
your environment.
To import external datasources:

1. From the Actions menu, select Import Datasources.

2. Click Import from File.

3. Search for and select the exported *.baqds file.

4. You can customize the list of imported items by selecting a check box next to each datasource, datasource
type and company settings you want to import.

5. Click Import.

10.2.700 417
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. View the Import process messages pane and verify the process is complete.

7. Click Close.
Verify the connection to an external is successful. If necessary, click Configure button to modify Database
Connection Parameters.

32 Bit vs 64 Bit ODBC

When you create an ODBC connection, it is important to understand which kind of Data Source Name (DSN) you
should use on the system. On an x64 system, you can create an ODBC connection (DSN) on the 32-bit side of
the system as well as on the 64-bit side.
The Epicor ICE3 framework used by Epicor ERP and BAQ takes bitness into account, when a user works with
BAQ External Data Sources and executes external queries. BAQ distinguishes 32bit and 64bit ODBC datasources
to provide compatibility between bitness of IIS process and of underlying ODBC driver dll file. Hence, if the
application utilizing the Epicor ICE 3 framework is running in the 64bit mode, it doesn't see 32bit DSNs, and vise
versa.

1. To configure 32bit ODBC datasources, you can call ODBC Data Source Administrator tool using this command
line:
%windir%\SysWOW64\odbcad32.exe

2. In order for BAQ to see and consume 32 bit ODBC datasources, in Internet Information Services (IIS) Manager,
select ERP10/ICE3 application pool.

3. Click Advanced Settings.

418 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

4. For Enable 32-Bit Applications property, select True.

5. To configure 64bit ODBC datasources, call ODBC Data Source Administrator tool using this command line:
%windir%\system32\odbcad32.exe

10.2.700 419
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

6. In ERP10/ICE3 application pool, for Enable 32-Bit Applications property, select False.

Microsoft does not support the side-by-side installation of 32- and 64-bit Microsoft Office or their
dependent components. If you need to have both MS Office ODBC driver variants on the same machine,
install the needed driver using the "/passive" command line parameter.

External Datasource Metadata Maintenance

Use the External Datasource Metadata Maintenance to modify column properties of data coming from an
external datasource.
In External Business Activity Designer, column properties such as format, label or description display according
to the underlying metadata specified in the source database. When there is no metadata specified for a table,
External Business Activity Designer automatically determines all required column properties.
In External Datasource Metadata Maintenance, you can manually change properties of columns you want to
include in your Business Activity Query.

420 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

First, select a Datasource Type for which you want to modify metadata and select one of the datasources
attached to the Datasource Type. The datasource you select provides a list tables you can select to modify
metadata.

Example
You want to create an updatable Business Activity Query (BAQ)
that displays the list of customers. Because you typically contact
your customers via email, you want to make sure the email
address field for each customer is filled. In External Datasource
Metadata Maintenance, you select a Datasource Type and a
Sample Datasource that provides the data for the query. You
will then search for a customer table that holds the information
you need. On the Field Detail sheet, highlight the email address
field and select the Required check box. When you create an
updatable BAQ and use it on a dashboard, users will not be
able to change the existing customer information or create a
new customer record unless they enter a value in the email
address field.

Retrieve External Tables


Use the following steps to retrieve tables for which you want to modify column properties from an external
datasource.
Navigate to External Datasource Metadata Maintenance.
Menu Path: System Management > External Business Activity Query > External Datasource Metadata

This program is not available in Epicor Web Access.

To retrieve external table:

1. In the Datasource Type field, search for an existing datasource type.

10.2.700 421
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

Datasource types are created in External DataSource


Type Maintenance. You can use datasource type to
describe security restrictions to schema and data of an
external datasource. Each external datasource that
provides the connection to an external database system
must be assigned to an existing datasource type.

2. The Owning Company inside which the selected DataSource Type was created, along with the Type
description display for your information only.

3. In the Sample Datasource field, select an external datasource associated with the selected datasource type,
for which you want to create metadata.

External datasource provides connection to an external


database system. Each datasource must be assigned to
an existing datasource type.

4. Click Test Connection to verify the connection to an external system is established.

5. To the Connection Successful message, click OK.

6. Click Tables.

7. In the External Tables window, search for a table or multiple tables for which you want to modify column
properties.

422 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

You can narrow down the list of tables you want to retrieve by entering a value in the Table Name
Starts with field and selecting a database schema.

8. In this example, select the DimCustomer table.

9. In the External Tables window, click OK.

10. The table you select display as a node in the Tree View on the left side of the form.

10.2.700 423
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

To modify table metadata, selecting a table is not


necessary. If you accept a default value of -- any table
in the database --, then any metadata changes you make
apply to the whole database. You can, for example, create
metadata for the Company column by adding a custom
description. All database tables using the Company
column will use the column description you create.

Use Table List


Use the Table List sheet to review the list of external tables you retrieved from an external datasource.

1. Navigate to the Table List sheet.

2. The grid displays the Customer table you retrieved form an external datasource.

3. You can enter a value in the Description field to create custom table description.
In this example, enter List of Customers.

424 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

You cannot modify the rest of the fields; they display for your information only.

Modify Field Properties


Use the following steps to manually change properties of columns you want to include in your Business Activity
Query.

1. In the Tree View, expand the table and select a field you want to modify.

2. In this example, select the EmailAddress field.

3. The Fields > Field Detail sheet is automatically selected, presenting the existing properties of the selected
field.

4. In the Description field, you can explain the field's purpose and provide other helpful information.
In this example, enter Customer Email Address.

5. The Field Table defines the column's title when used on a query or a dashboard.
In this example, enter Email.

6. The Format displays the layout for the characters within the field. This value can be displayed in either
schema or alphanumeric format. You can change this value if necessary.

7. By selecting the Required check box you indicate the field cannot be empty. When users attempt to save
a new or existing record within the query and this field is blank, they will not able to save the record until
they enter a value in this field.

8. If you want to prevent users from changing the data in this field, select the Read Only check box.

10.2.700 425
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

9. To view the list of all fields of the selected external table, navigate to the Fields > Field List sheet.

10. View the metadata information you entered for the EmailAddress field.
You can use this sheet to modify properties of multiple fields at once, for example, to make certain fields
mandatory, change their label and so on.

11. Once complete, click Save.

Enable External Datasources

Before you can use the created datasource to build an External Business Activity Query, you must authorize it for
the current company.
Use the BAQ External Datasources sheet within Company Maintenance to enable external datasources for the
company. On this sheet, you can also configure which of the available filters (from the Datasource Type associated
with the each of the chosen External Datasources) to use, or skip when External BAQs are executed in this
company. Using this approach, different companies can user the same External Datasource/Datasource Type but
bypass or execute the filters differently.
Navigate to Company Maintenance.
Menu Path: System Setup > Company/Site Maintenance > Company Maintenance

This program is not available in Epicor Web Access.

1. Select the BAQ External Datasources sheet.

426 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

2. In the Datasources grid, based on Company Visibility and Owning Company, all datasources on the server,
or within the Tenancy (SaaS installations) appear as available for enabling.

3. Select the Enabled check box for each datasource you want to make available within the current company.

Only the authorized datasources become available for use


in External BAQ Designer.

4. The Company field displays the Owning Company of each datasource. Note each record can only be
modified from its Owning Company.

5. If you want to skip security checking for the selected datasource, in the Datasources grid, select the Skip
Filter check box. Once selected, Filter Groups and Filter Definitions specified for the datasource are ignored.

6. If you wish to skip security checking for a specific group defined for the selected datasource, in the Filter
Groups grid, select the Skip Filter check box.

Example
In the External Datasource Type Maintenance, you
can create multiple filter groups. The selected external
datasource retrieves the required data based on
datasource type settings. For example, you can filter the

10.2.700 427
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

external data by a specific company and parts you want


to display in a dashboard. In the future, a request may
occur to display the information in the dashboard for all
companies. In such case, you can use the Skip Filter check
box to ignore the filtering for the selected group.

7. If the selected filter group uses a Default constant to filter the data, you can use the Filter Definitions grid
to override this constant.

8. The current value of the selected constant displays in the Constant Value field.
In this example, the current company value is EPIC06.

9. If you want to override this constant by applying a custom value, clear the Use Default check box and enter
a custom constant in the Value field, for example, EPIC03.

Design External Business Activity Query

External Business Activity Query provides the mechanism for retrieving, updating and displaying information from
an external database using the SQL language. It serves as an interface you use to create custom SQL text. The
query text is then sent to the database server using the selected .NET provider, where it is executed. The information
you retrieve serves as a data source for reports, dashboards or searches.
Navigate to External Business Activity Query.
Menu Path: System Management > External Business Activity Query > External Business Activity Query

This program is not available in Epicor Web Access.

1. Click New.

428 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

2. In the Query ID field, enter a unique identifier for your query.

A Query ID can only contain letter characters, digits,


dashes, or underscores. It cannot begin or end with a
dash or an underscore.
If you enter any restricted character, an error message
displays.

3. In the Description field, enter a concise explanation for the query.

4. Notice the Author field displays the name of the user who created the current business activity query. Other
users cannot modify the current query. If you need to assign author rights to another user, use the Actions
> Change Author option.

5. The Owning Company displays the company inside which the current external BAQ was created. You
cannot change this value; only users within the Owning Company can modify this BAQ.
If the All Companies check box is selected, then companies within the same organization as the Owning
Company can view and use the query. If the System BAQ check box is selected, the Owning Company field
is blank. This indicates the current BAQ is available to all companies within the current organization.

6. If you want to make this query is available to all users, select the Shared check box.

7. The All Companies check box controls whether the current BAQ Definition is visible to all companies on
the same database server. When the Epicor application uses multiple companies contained within a single
database, the BAQ usage and visibility is applied regardless of multi-company direct configuration. For
companies hosted on different databases, this check box initiates the Service Bus processing, when it is
configured to synchronize BAQs to external companies.
If the custom BAQ is created from a Company that is running under a multi-tenant license, the definition
becomes visible to all companies within the same Tenancy as the Owning Company.
The options/values for tenant and multi-tenant features are only for Epicor hosted environments. Typically
you can ignore these options. Internal Epicor administrators who need more information should refer to
the Epicor SaaS Installation Guide.

The following rules apply to usage of BAQs visible across companies:


• The BAQ definition can only be updated from the original company, but is available for review and
execution in other companies. To modify the BAQ definition in other companies, you need to create a
copy of the BAQ.
• The BAQ ID of queries having the All Companies property must be unique across all companies.
• When you create a BAQ visible across companies in Company A, and Company B uses a local BAQ with
the same ID, a warning message displays. A user is informed that in Company B, the local BAQ is used
and the BAQ created in Company A will not be available for use.
• Likewise, when you create a local BAQ in Company A and a BAQ visible to all companies, having the
same ID, already exists in the Company B, a warning message displays. A user is informed that the local
BAQ will take precedence over the All Companies BAQ. The same principle is true for the BAQ import
process.

The local BAQ always take precedence over the BAQ


visible to all companies, when the naming conflict
occurs.

10.2.700 429
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

To see in which companies (outside the current company), references to the BAQ were created, use the
Where Used tabs.

8. The System BAQ check box indicates whether the current BAQ is installed with the Epicor ERP application.

This option only applies to ordinal BAQs, External BAQs


are not delivered with ERP10 application.

9. If you want to update the external database using this query, select the Updatable check box.

10. Cross-Company functionality controls the ability to bring back results across multiple companies.

You can only use this option with ordinal BAQs, this
feature is not supported in External BAQs.

11. In the External Datasource name field, select an external datasource available for the current company.

12. Click Test Connection to verify your connection to an external database is established.

13. To the connection message, click OK.

14. You continue design the query in the same way as in Business Activity Query Designer.
The External BAQ Designer UI is almost identical as Business Activity Query Designer that is designed to work
with MS SQL Server 2008 and higher. All criteria filters, function lists in calculated fields, expressions,
supported SubQueries and SubQuery types are not modified in External BAQ UI.
A user designing an external query should only use those External BAQ Designer features which are supported
by the foreign Database Management System it uses.

Example

430 10.2.700
Epicor ICE 3.2 Tools User Guide External Business Activity Queries | Chapter 2

For more information on how to construct a business activity query, see the Business Activity Queries
chapter.

Update External Datasource

This topic provides general guidance for using an External Updatable Business Activity query to update an external
database.
When you pull external data into the Epicor ERP, you may as well want to be able to update this data in the
application and submit the changes back to the external datasource.
The implementation involves several processes that are described in more detail in the respective topics of this
guide and later in this topic. You first need to define your external datasource in the application and connect to
it - please refer to the External Datasource Maintenance on page 408 topic for details on this process. You then
need to create an External BAQ against your external database and make that BAQ updatable - the Design
External Business Activity Query on page 428. Finally, you need to add your custom update code specific to the
type of the external datasource you interact with.

1. Launch External Business Activity Query Designer.


Menu Path: System Management > External Business Activity Query.

2. In the Main Menu, click New to create a new query.

3. Define the general properties: Query ID, Description, and External Datasource; Select the Updatable
check box.

4. Navigate to the Query Builder > Phrase Build sheet.

10.2.700 431
Chapter 2 | External Business Activity Queries Epicor ICE 3.2 Tools User Guide

5. Select external database table(s) that contain data you need to pull and add them to the canvas.

6. On the Display Fields > Column Select, choose the columns from the previously specified tables that you
wish to display in the results grid.

7. On the Update > General Properties sheet, define the Updatable Query Settings per your needs.
If want to be able to update several records at once, make sure you select the Allow Multiple Row Update
option.

8. In the Updatable Columns grid, mark the field(s) you need to update as Updatable.

9. Open the Update Processing sheet.

10. In the Processing method section, select the Advanced BPM Update only and click the BPM Directives
Configuration button.
The Updatatble BAQ Method Directives window pops up.

11. With the Update method selected, in the Main Menu, go to New > New Base Processing.
The Base Processing > Detail sheet opens for editing.

12. Enter a Directive Name and Description, then click Design.


The BPM Workflow Designer launches.
At this stage, you can, for example, add an Execute Custom Code widget to the flow or use an Invoke
Function widget to call a Custom Code Function. Either way, use the below boilerplate code to define your
custom update logic:
//Get query results and trim them to just the updated columns

var resultQuery = queryResultDataset.Results


.Where(row => !row.Unchanged());

//Define the results processing logic

foreach (var ttResult in resultQuery)


{
//Define your update action here
}

13. Save your workflow and close the Designer.

14. Enable and save the directive; close the Updatable BAQ Method Directives window.

15. Save the query.

If you need help setting up the integration with a specific external datasource, please contact the Epicor's
Professional Services team for assistance.

432 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

Chapter 3: BAQ Report Designer

Use the BAQ Report Designer to turn a Business Activity Query (BAQ) into a SQL Server Reporting Services (SSRS) report.
You create a personalized BAQ through the Business Activity Query Designer. You then use the BAQ Report Designer
to select the BAQ as the base for a report, and to define the option fields, filters, and sort by options that appear on
the report interface. The reports you create through this tool are flat reports, which means they only pull data from
the table(s) defined on the selected BAQ. If you need to pull data from multiple queries (and so multiple tables), use a
Dashboard report to expand the amount of data to include. Dashboard reports are discussed in the Dashboards chapter.
To design and format the report, you use either Microsoft SQL Server Report Builder or Crystal Reports (provided for
backward compatibility with older reports). Once you complete the report layout, you can add it to the menu for users
to access. Then launch Report Style Maintenance to create a report style or styles for it. The style determines which
companies can access the BAQ report and other key options. You can also design a routing rule for each BAQ report.
Routing rules help you streamline reporting for specific business needs. They can be simple rules that define an alternate
report style users run when they need to print a report using a unique format, or complex rules that divide, or break,
the report run into multiple dataset partitions which they can link to separate rendering workflows for generating,
printing, previewing, and sending the report output.

This chapter focuses on designing the report interface in the


application and provides an example of working with the Microsoft
SQL Server Report Builder. See the application online help for more
information about program features supporting Crystal reports.
Likewise for more information on report style and routing rules,
review the reporting courses, the Reports and Routing Rules sections
in the application help, and/or the Reporting Tools chapter in the
Implementation User Guide.

BAQ and BAQ Report Datasets

A BAQ report is based on a selected existing BAQ and includes four standard datasets.
Before you create a report, you must first define the BAQ you are going to use. You can use an available BAQ
or create a new BAQ in the Business Activity Query Designer. The BAQ you use must contain the Company column
that is necessary to join the standard tables in the datasets (using the Company ID), and, most importantly, the
BAQReportParameter table. Once you identify the BAQ for your report, you use the BAQ Report Designer to
create a new BAQ report.
Each BAQ report contains four tables that display as the report's datasets in the Report Builder:
• Company – This table defines your Company ID and Company Name values, ensuring the BAQ is synchronized
with your company's data.
• RptLabels – The Epicor application uses this table for the standard text labels that display on the reports. This
table contains all the language versions of the current report. These report labels generate the field labels, so
each field on the report can display in a different language by matching the Label Name for each item.
• BAQReportParameter – The information written to this table originates from the parameter information
entered on the report user interface (UI). This information is used for two purposes: to display the parameters
on the report, and, when designing the report, to control sorting, summary, grouping, and so on.
• BAQReportResult table – This table contains the specific data pulled from the database that matches the
query parameters.

10.2.700 433
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

Standard BAQ Report Interface

There are several standard BAQ reports, delivered with the application, that were created using the BAQ Report
Designer program.
Use the following steps to review the form (application interface) of the standard BAQ report Rebate Contract
Transactions. Being familiar with the BAQ report interface will help you when creating a new BAQ report later
in this chapter.

1. Navigate to the Rebate Contract Transaction Report form.


Menu Path: Financial Management > Rebates, Promotions and Royalties > Reports > Rebate Contract
Transactions

2. On the Selection sheet, the Report Options section displays fields for entering report parameters. In this
example, options include Start Invoice Date, End Invoice Date, Start Transaction Date, and End
Transaction Date. These options were defined when the BAQ report was created.

3. The Filter Summary section displays four filters - Part, Product Group, Customer, and Rebate. The
available filters also were defined when the BAQ reports was created.

434 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

4. To access the Filters, select the Filter sheet.

5. On the Filter sheet, click the Part button to search for and select a part or group of parts.

6. The selected parts display in the Part List.

7. Return to the Selection sheet.

10.2.700 435
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

8. The Filter Summary section displays Some Selected in the text box next to the filtered field.

If you have not selected any records for filtering, the


application assumes all records are selected.

9. Use the Sort By field to choose how you want the information in the report sorted when it prints. In this
example, the report is sorted by Customer and then by Invoice Date. The available sorting criteria also were
defined when the BAQ reports was created.

10. By default, all reports contain the remaining fields for Report Style, Schedule, Archive Period, and User
Description.

11. Click the Print Preview button on the standard toolbar to display the report on your screen. PDF is the
default display for the Standard - SSRS report style.

12. Use the Generate Only button to generate each report as an electronic file to view and print later. The
generated report is available to preview and print for a period of time you define on the report window.

13. Click the Generate for Design button on the standard toolbar to modify BAQ reports. The generated
report appears on the System Monitor. From here you launch the Design and Test SSRS program that enables

436 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

you to download the SSRS Report Data Definition to a local working copy and interact with SSRS Report
Builder.

BAQ Report Options

Use this action to define options for Crystal Reports.

1. Navigate to the BAQ Report Designer.


Menu Path: System Management > Business Activity Queries > BAQ Report Designer

This program is not available in Epicor Web Access.

2. From the Actions menu, select BAQ Report Options.

3. In the BAQ Report Options dialog box, you can see the Crystal Report Options that are retained for
compatibility with previous application releases.

4. In the Crystal Report Executable field, browse for or enter the path to the Crystal Reports .exe file.
The system will launch Crystal Reports when you choose to design your report using this program.

10.2.700 437
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

5. Use the Local Reports Directory field to define the directory you use to save your BAQ Report (.rpt) files.
When you create reports within the BAQ Report Designer, they automatically save to this location. Later
when you launch Crystal Reports, you can navigate to this directory path and open the .rpt file. You may
then modify the layout of this report.

6. If you select the Copy Report Locally option, the BAQ Report Designer creates a duplicate copy of each
BAQ report. This file is then a backup copy for the report.

7. Click Apply if any changes were made, then close this dialog box.

Create a BAQ Report

This example demonstrates how to create a BAQ report based on an existing BAQ, design the report layout in
the SSRS Report Builder, save the report (.rdl) on the SSRS Report Server, and add the report to the application
menu. Advanced users can design both BAQs and SSRS reports that address complex data reporting requirements.

You must have access to the SSRS Reporting Services


Configuration Manager, Report Manager, and Report
Builder for your SQL Server report server. Your access to these
tools must include sufficient user role assignments to create
folders and save report files on the report server.
Your administrator can set user role assignments on the Report
Manager Folder Settings page. We recommend that your
user account have all the roles selected. This includes Browser,
Content Manager, My Reports, Publisher, and Report
Builder.
Ensure security for the root Reports folder is inherited from
Parent Security or is otherwise appropriately defined to allow
user access.

Add the BAQ Report

In the BAQ Report Designer, add and save a new report.

1. Navigate to the BAQ Report Designer.


Menu Path: System Management > Business Activity Queries > BAQ Report Designer

This program is not available in Epicor Web Access.

438 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

2. From the New menu, select New Report Definition.

3. Use the Company drop-down list to define the company for which this BAQ report is created. If you are in
an Epicor ERP environment, you can create BAQ reports for either all companies or the current company. If
you are in an Express or Saas Standard environment, this drop-down list is read-only and displays the current
company. In this example, select the All option.

4. Working on the Detail sheet, in the Report ID field, enter an ID for the new report. In this example, enter
CustOV.
The Report ID cannot contain any spaces. Once you enter and save a Report ID, you cannot change this
identifier. You can, however, make a copy of the report to create a new identifier.
If you know the name of the BAQ, you can enter it directly in the BAQ ID field.

10.2.700 439
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

5. Enter a Description for the report. In this example, enter BAQ Report - Customer List.

6. Click the BAQ ID button to search for and select the BAQ to use in this report. In this example, choose
zES_Customers.

7. The text entered in the Form Title field displays as the title of the report. In this example, enter Customers
Overview.

8. For SSRS Report, note that CustOV.rdl has been added automatically based on the value in Report ID.

9. Click Save.

10. A new combination of report data definition and report style has been created automatically for your new
BAQ Report. To review, navigate to Report Maintenance. You can leave the BAQ Report Designer open.
Menu Path: System Management > Reporting > Report Style

This program is not available in Epicor Web Access.

11. Click ReportID and then locate and retrieve CustOV.

12. Click the Styles tab.

440 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

13. Note the following:


• Description and Report Type both indicate an SSRS report.
• Data Definition identifies the report data definition that has been created automatically for your new
report.
• Report Location is the report's location on the SSRS report server relative to the report server settings
in your Epicor ERP application server configuration.

14. Close Report Maintenance and remain in BAQ Report Designer.

10.2.700 441
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

Add Option Fields

Use the Option Fields sheet to set up record selection criteria users can enter as parameters when running the
report. In this example, add fields for the state where a customer is located and for the customer name.

1. From the New menu, select New Option Field.

2. The Option Fields sheet automatically displays with a line for the new option.

442 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

3. Option Field indicates the BAQ Report column on which the option is based. All the columns contained
within the selected BAQ appear on this list, as well as report parameter columns such as
ReportParam_Character01, ReportParam_Number02, ReportParam_Date05, and so on. For this example,
select Customer_State.

4. For FieldLabel, leave the default State/Prov.


FieldLabel is the text that displays next to the option field on the report form.

5. For Compare Operator, leave the default = (Equal To).

6. For Data Type, leave the default nvarchar. This value is based on the data definition of the field selected
in the option field.

7. Click the New button to add one more line for another option.

8. In the line for the new option, for Option Field, select Customer_Name.

9. Change the FieldLabel value to Customer Name.

10. For Compare Operator, leave the default = (Equal To).

11. The Data Type field again defaults to nvarchar.

12. In the Order column, enter 1 for the Customer_Name option and enter 2 for the Customer_State option.
This sets the order in which the options fields display on the report form.

10.2.700 443
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

13. Click Save and remain in the BAQ Report Designer.

Test the Report

In BAQ Report Designer, use the Test Report Form action to perform an initial test of the new report.
This verifies the report form and print preview functionality for the new report and enables you to obtain, from
the System Monitor, the report's TableGuid identifier that will be needed for testing the report while you are
working on the report design in Report Builder.

1. With the new report CustOV displayed on the BAQ Report Designer Details sheet, choose Actions > Test
Report Form to display the report's form.

2. On the report form, verify that the option fields that have been added to the form are present.

444 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

3. Choose Print Preview to display the report.

4. The report displays with a header layout based on the template for new SSRS reports. Note that the BAQ
that is the basis for the report is shown as is the report title that was entered when creating the report.
In the application, PDF is the default print preview format for SSRS reports, Later in the chapter, SSRS Report
Builder will be used to add data fields to this starting point.

5. Close the report and report form, launch the application's System Monitor. Navigate to the Reports sheet
and locate the line for your report.

6. The TableGuid identifier is in the FileName column. You may need to scroll to the far right end of the grid
to locate the column.
The value will be similar to this example. Record , for later use, the actual value you are seeing. You will not
need the REPORT DATABASE: portion.

7. Close or minimize the System Monitor and remain in the BAQ Report Designer.

10.2.700 445
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

Design the Report Layout

Use SSRS Report Builder to design the new report's data layout.

1. With the new report CustOV displayed on the BAQ Report Designer Details sheet, choose Actions >
Download SSRS Report.

In order to download the SSRS report, your account must


have the SSRS Report Designer privilege enabled in
User Account Security Maintenance.

Select location and save the report file.

446 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

2. Open the report with Report Builder to edit and design its layout. For a new report, the report header layout
stored in the template file BAQReport.rdl is applied automatically.

3. In Report Builder, select the Insert tab and then select Table > Table Wizard to run the New Table or
Matrix wizard.

4. On the wizard's Choose a dataset screen, choose the dataset that will be the source of the fields that you
add to the report design. For this example, choose BAQReportResult, which is a one of the standard
datasets associated with a BAQ and BAQ report. Click Next.

10.2.700 447
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

5. Starting in the Available Fields list on the Arrange Fields screen, move fields into the report layout. For
this example, move the following fields and then click Next.
• Move Customer_Name, SalesRep_Name, Customer_City, Customer_State, and Customer_Country
to Row Groups.
• Move Customer_CustID and Customer CreditHold to Values.

448 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

6. On the Choose the Layout screen, enable or disable options for showing totals and grouped data. For this
example, clear all options and click Next.

7. On the Choose a Style screen, choose a style that controls fonts and color. For this example, accept the
default and click Finish to close the wizard.

10.2.700 449
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

8. The report layout now includes the selected data fields and choices for layout and style.

9. Click the Report Builder button and then click Save.


Optionally, you can click the Report Builder button again and choose Open to review the report's folder
location on the SSRS report server.

10. To test your design in Report Builder, verify that you are on the Home tab and click Run.

450 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

11. At the top of the report page, enter the TableGuid identifier obtained from the application System Monitor
earlier in the chapter and click View Report.
The report runs in HTML format, as it would if it was run from SQL Server Report Manager.

12. When done, click Design to return to the Home tab.

13. In Report Builder, you can continue to make adjustments to the report design. As you work, be sure to save
and retest the report as described in steps 9-12. When you are satisfied with the report, click the Report
Builder button and choose Exit Report Builder.

10.2.700 451
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

14. In BAQ Report Designer, click Actions > Upload SSRS Report.

In order to upload the SSRS report, your account must


have the SSRS Report Designer privilege enabled in
User Account Security Maintenance.

When you specify the path to the report file you are
uploading, make sure you don't drill down beyond the
parent folder of the reports folder that was created
automatically during download. For example, if you report
has been downloaded to
User/Documents/reports/CustomReports/, the path
for upload will look like this: User/Documents/.

15. In BAQ Report Designer, test the report to verify it in the application. Click Actions > Test Report Form
to open the report's form.

452 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

16. Click Print Preview to display the report with your design work. Leave the Report Options fields blank
for this test.

17. The report, including all customers, displays in PDF format.

10.2.700 453
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

18. Close the report and test the report options added to the form earlier in the chapter. In the State/Prov
field, enter MN and click Print Preview.

19. The report displays with the list limited to customers located in Minnesota. Close the report and report form
when done, but remain in the application.

454 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

Implement the Report

Add the BAQ report to the menu system in the Epicor ERP application.
For this example, the BAQ report is added to the application menu structure under Sales Management. You can
use locations and values that match the report you are working with.

1. Launch Menu Maintenance.


Menu Path: System Setup > Security Maintenance > Menu Maintenance

This program is not available in Epicor Web Access.

10.2.700 455
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

2. On the Menu Maintenance tree, navigate to: Main Menu > Sales Management > Order Management
> Reports. Verify Reports is highlighted.

3. click the Down Arrow next to the New button; select New Menu.

4. On the Detail sheet for the new menu item, enter a value in the Menu ID field. UDXXX01 is entered for
this example.

It is an important standard practice to use a UD prefix


when adding a menu ID. UD stands for User Defined. It
is further recommended that you use UDXXX as shown
in this example and replace XXX with your initials.

456 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

5. In the Name field, enter Customers Overview to match the report title.

6. Enter a value in the Order Sequence field. For this example, 997 is entered which will place the new menu
item at or near the end of the current list of menu items.

7. Click the Program Type drop-down menu and select BAQ Report.

8. Click Report and then search for and choose the BAQ report. In this example, choose CustOV.

9. Click Save and click OK if you get a security update message.

10. After giving the application about 10 minutes for a scheduled update (or after logging out and back in to
force the update), open the Customers Overview report form.
Menu Path: Sales Management > Order Management > Reports > Customers Overview

10.2.700 457
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

11. To display the report, click Print Preview.

12. The report displays in PDF format, as it has earlier in the chapter during report development and testing.

Customize a BAQ Report

The Epicor ERP application customization functionality enables you to add fields to form, including user-defined
fields. Within the customization itself, you can create form and row rules which run whenever users enter data

458 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

or perform other actions which activate these rules. These rules in turn launch custom events which you define
on the customization.
If you have customization rights, you have full access to all the customization tools available in the Epicor
application. Leverage this functionality to make the BAQ report an efficient and valuable reporting tool for any
business flow within your organization.
The following procedure provides an overview of the workflow for enabling and working with customization
tools.

1. Turn on Developer Mode.

a. When running the application with Modern Home Page interface, you can do this by expanding the
Application Bar at the bottom of the home page and selecting the Wrench icon. Alternately, from the
application Home Page, go to the Settings Page, select General Options and then select Developer
Mode.

b. If you run the application using Kinetic Home Page interface, use the overflow menu in the top right
corner of the home page window to select Developer Mode.

You can also press Ctrl + Shift + D to activate Developer


Mode.

2. Navigate to and open the BAQ report. In this example, navigate to Sales Management > Order
Management > Reports > Customers Overview to open the BAQ report created earlier in the chapter.
With Developer Mode enabled, the Select Customization window displays. All existing customizations for
the BAQ report display. For this example, there are no existing customizations.

10.2.700 459
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

3. To create a customization from the original report form, select the Base Only check box and click OK.

4. The BAQ report form displays. To customize this form, click the Tools menu and select Customization.

5. The Customization Tools Dialog displays on top of the report form window. Notice also that a grid now
overlays on top of the report form.

460 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

6. You can now add fields, create rules, and modify the code for the report program. You access all of this
functionality within the various tabs and the Tools menu on the Customization Tools Dialog.
To learn about the customization tools, review the Epicor ICE User Experience and Customization Guide.
Multiple chapters within this book describe all of the customization tools in detail.

10.2.700 461
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

7. After you finish customizing the form, click Save on the Customization Tools Dialog.

8. In the Customization Save Dialog enter a unique Name for the customization. For this example, enter
Customers List Custom01.

462 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

9. Enter a Description that helps identify the purpose for the customized BAQ report. For this example, enter
Customization Demo.

10. Click Save. Optionally enter comments when prompted and click OK. Exit Customization Tools Dialog.

11. Turn off Developer Mode.

a. When running the application with Modern Home Page interface, you can do this by expanding the
Application Bar at the bottom of the home page and deselecting the Wrench icon. Alternately, from
the application Home Page, go to the Settings Page, select General Options and then clear Developer
Mode.

10.2.700 463
Chapter 3 | BAQ Report Designer Epicor ICE 3.2 Tools User Guide

b. If you run the application using Kinetic Home Page interface, use the overflow menu in the top right
corner of the home page window to select Developer Mode.

12. You now can add the customization to the application menu. Open Menu Maintenance
Menu Path: System Setup > System Maintenance > Menu Maintenance

This program is not available in Epicor Web Access.

In the Menu Maintenance tree, select the BAQ report for which you have created a customization. In this
example, navigate to and select Customers Overview.

464 10.2.700
Epicor ICE 3.2 Tools User Guide BAQ Report Designer | Chapter 3

13. On the Detail sheet, select the customization from the Customization drop-down list.

14. Click Save on the Standard toolbar.

Your customized form now is applied when the report is selected from the application menu. Users within the
current company will now use this custom version of the BAQ report.

10.2.700 465
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Chapter 4: Searches

Search programs are available throughout the application. The standard searching tools enable you to easily locate
and organize records using filters and specific criteria. In addition to the standard searches, you can also create your
own specific searches to quickly and precisely locate the information you need, where and when you need it.
Tools are available to modify search programs. Quick Searches are customized search programs you can create from
Business Activity Queries (BAQs) that pull in unique search results. BAQ Searches leverage BAQs to locate search results.
Advanced Searches are set up within a smart client dashboard; they contain specific fields you can use for defining the
search results. Use Data Tag Searches to find records grouped together through a specific data tag definition assigned
to each record. Create Named Searches that use the default options you want when the search program is launched.
The Enterprise Search is a separate search application you can use to retrieve structured content - like sales orders,
jobs, AR invoices - from your Epicor database.
This chapter explores how you can create and use these search programs, so your users can more efficiently locate the
information they need throughout the application.

Default Search Interface

You launch search programs by clicking the search buttons found on the sheets within the application. Typically,
these buttons are labeled with the primary record queried through the search program. You can also launch
some search programs by clicking the Binoculars button on the Standard toolbar.

1. In this example, the Sales Order button for the Sales Order Entry > Summary sheet displays.

2. You can also search for sales orders by clicking the Binoculars button on the Standard toolbar.

When you click the search button, the record’s search program appears. In this example, clicking the Sales Order
button launches the Sales Order Search program.

Default Features

Default features on each search window:

1. The Basic sheet displays all the default options within the search program. These items are the primary fields
you can use to limit the search results.

466 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

2. Use the Quick Search sheet to find and select a quick search program.

3. The BAQ sheet contains a list of available Business Activity Queries you can use to generate the search
results.

4. The Advanced sheet contains a list of available Advanced Search options created through the Dashboard
program.

5. The Data Tags sheet contains a free-form field where you can enter one or more data tags applied to the
records for which you are searching.

6. Use the Named Search drop-down list to select a named search option. When you select a named search,
either the Basic sheet’s search options populate with pre-defined values, or the BAQ Search or Quick Search
program displays. Click the Named Search button to create Named Searches.

Named Searches, Quick Searches, BAQ Searches,


Advanced Searches, and Data Tag Searches are explored
later in this chapter.

7. To begin your search, click the Search button.

8. The records display in the Search Results grid.

10.2.700 467
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

9. To pull in multiple records within the current program, highlight two or more records on the grid and then
click OK.

10. To pull in the first 100 records, click the Select 1 - 100 button.

11. To display the next set of records in the grid, click the Next 100 button.

12. Click the New Search button to clear the results and start a new search.

13. To save the current search settings but remove the current search results, click the Clear Results button.

14. You can also limit how many rows are returned within the search results. To do this, click the Options
button.

15. The Search Options window displays.

468 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

16. If you want all the available rows to display within the Search Results grid, select the Return All Rows check
box.

17. When you finish defining the search options, click OK.

18. To limit how many rows display within the Search Results grid, enter a value within the Maximum Rows
Returned field. In this example, this search program only displays the first 100 records in the Search Results
grid.

19. When you finish defining the search options, click OK.

Hot Key Searches

To open the search program on any field where a search is available, press <Ctrl> + S. If data is available in the
field, the search program displays with this specific data in the Starting At field and then returns search results
based on that value. If the field is blank, the search form displays, but the search results do not return automatically.
To perform a hot key search:

1. Place your cursor in a field that has a search program and enter the data you want to use to retrieve search
results; press <Ctrl> + S on your keyboard.

10.2.700 469
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

2. The search program displays.

470 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

3. The data entered into the field appears in the Starting At field.

4. The search is run and the results display in the Search Results grid.

These features are available within each search program. The rest of this chapter explains how you can modify
and personalize these search programs.

Quick Searches

The Quick Search functionality is a dynamic tool you use to create configurable searches that improve the
productivity of search results. You can privately restrict quick searches for your own user account or share them
publicly for other user accounts.
A quick search can be the default search program that displays when a search is launched either from the Standard
toolbar’s Search button or from a specific field’s search button. It can also be the primary search that displays
with other key programs near the top of a context menu. All quick searches appear on the Quick Searches sheet
within basic search programs that query similar data. Quick searches can also be used with the Named Search
feature, so you can launch a quick search immediately.

10.2.700 471
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Create a Quick Search

The Quick Search functionality is a dynamic tool you use to create configurable searches you can then use within
your own user account or share publicly for other user accounts - improving the productivity of searches.

Activate Quick Search

You indicate which users can create quick searches through User Account Maintenance.
Menu Path: System Setup > Security Maintenance > User Account Security Maintenance
To give a specific user the Quick Search rights:

1. Select a specific user on the Detail sheet.

2. Navigate to the Options sheet.

3. Within the Tools Options group box, select the Can Maintain Quick Search check box.

4. Select the Can Maintain Enterprise Quick Search check box to indicate this user can create quick searches
using the Enterprise Search feature. This functionality is explored later in this chapter.

472 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

5. Click Save on the Standard toolbar.

This user can now create and update quick searches throughout the application.

Quick Search Detail Sheet

You create quick searches through Quick Search Maintenance. To launch this program, right-click any field used
for searches and select Quick Search Entry from the context menu. In this example, you create a quick search for
Serial Tracked Parts.

1. First, right-click within the Part field; a context menu displays.

2. Select Quick Search Entry.

If the Quick Search Entry option is not available from the


field's context menu, launch the Quick Search
Maintenance program from the main Search window. To
do this, click on the Search icon in the Main Toolbar.
Then right-click anywhere on the background of the
search form and select the Quick Search Entry option
from the context menu.

10.2.700 473
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

3. The Quick Search Maintenance program displays.

4. To create a new search, click the New button on the Standard toolbar. Note that the System check box
is clear which indicates that this search is created by user. System quick searches are installed with the Epicor
ERP application, and Epicor recommends not to change them.

5. Enter a Quick Search ID for the quick search. This identifier displays on the Quick Search tab found within
search programs that query similar data. In this example, you enter SerialTracked.

6. Enter a Description for the quick search. This defines the concise explanation for the quick search; it also
displays on Quick Search tabs.

7. Now click the BAQ button to find and select the Business Activity Query used as the base query for the
quick search. You can use the system BAQs for the search. You can also use any custom BAQs you create.
In this example, you select EPIC03-SerialParts.

8. If you want to create a new BAQ or edit an existing BAQ, select Business Activity Query from the Actions
menu.

To learn how to create Business Activity Queries, refer to


the Business Activity Queries chapter. To learn how to use
a Business Activity Query as a search option, refer to the
BAQ Search section later in this chapter.

9. Select the BAQ column used to return the search results from the Return Column list. All the columns from
the selected BAQ display on the list. In this example, you select the Part_PartNum option.

10. The Context Key (Like) field indicates whether this quick search is linked to any other search input fields
that share the same LIKE property. If you are creating a quick search against an input field that does not
share a LIKE property with another field, the Context Key (Like) field is blank.

11. The Called From field defines the program from which this quick search pulls its data. In this example, the
quick search pulls its data from the Erp.UI.PartEntry program (form).

474 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

12. The Created by field displays the name of the user that created the quick search.

13. If you want this quick search available for all users within the company, select the Shared check box.

14. The All Occurrences check box defines where this quick search is used. When selected, the check box
indicates this quick search is available for all searches that share its Context Key (Like) property. When clear
however, the check box indicates this quick search is only available from the primary program that launches,
or calls, this quick search.
For example, you create a quick search that has Part_PartNum as its Context Key (Like) value. If you do
not select the All Occurrences check box, this quick search is only available from within Part Maintenance.
If you select this check box, however, this quick search is available when users search for parts within Sales
Order Entry, Opportunity/Quote Entry, Job Entry, and anywhere else users search for a part number value.

15. Select the Context Default check box to indicate this quick search appears with the main options at the
top of the search input field’s context menu.

16. Select the Base Default check box to indicate this quick search is the primary search program for the current
search input field. When users click the Search button on the Standard toolbar or a search button next to
a field, this quick search program displays instead of the original search program.

17. You can also use the Suppress Base check box to indicate whether the base search form is available to
users. When selected, the Base Search button does not appear on the quick search window. Users are then
prevented from displaying the original search form. To override this setting, users can press the <Shift> key
while clicking the search button; the base search form will launch instead. Suppress Base checkbox is
enabled when the Base Default is checked.

18. Select the Validation Only check box to utilize the quick search as a data entry validation tool. The
Validation Only Quick Search is used to verify, while you enter data, the new value entered into the
Context Key (Like) Data Column. When this change is sent to the database, the new value is compared
against the results of the Validation Only Quick Search. If the new value is found within the quick search
results, the data is entered into the database. If the new value is not found in the quick search results,
however, then a Quick Search Validation Exception message displays and you are not able to enter this value
into the data. For more information about creating quick search criteria, read the next Create a Quick Search
– Criteria section.

This functionality only works when the quick search criteria


do not use any Prompt Type values. If one of the criteria
values is Prompt Type, the Validation Only check box is
not available.

For example, you want to create a customization that only displays Cash Sales for customers from a specific
American state – Minnesota. A system Business Activity Query (BAQ) is available called zCustomer01 that
searches for these records. You decide to use a Validation Only quick search against this BAQ to validate
the customer data can only be pulled from Minnesota records. You create a quick search that has one
criterion: Customer_State Equals Constant “MN”. The Validation Only Quick Search then makes sure that
all the entered Cash Sales customer records have Minnesota addresses.

19. When you finish defining the main attributes of the quick search, click Save.

10.2.700 475
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Quick Search Criteria

When you finish defining the main details of your quick search, you need to indicate which search input fields
display on the quick search form. To do this, you set up criteria for each field.

1. Navigate to the Criteria > Detail sheet.

2. The first criterion you create is a check box used for finding serial tracked parts. To do this, click the New
menu.

3. Select New Quick Search Criteria.

4. Now select the Criteria Column you need. This column from the Business Activity Query is used for the
search input field. All the columns from the BAQ selected on the Detail sheet display on this list. In this
example, select the Part_TrackSerialNum column.

5. The text you enter in the Caption field displays on the quick search form. In this example, accept the default
value of Track Serial.

6. The Condition value defines how the search input field evaluates the value the user enters. The search
results that display resolve against the condition you select from this list. In this example, select = (Equal
To). Available options:
• = (Equal To) – This condition returns a search result if it is the same as the search value. This condition
also ignores trailing blanks, so “abc” is equal to “abc “. Typically, you use this condition instead of the
MATCHES condition, as this condition has better performance.
• < > (Not Equal To) – This condition returns a search result if the first expression is not equal to the
second expression.
• > (Greater Than) – This condition returns a search result if the first expression is greater than the second
expression.
• < (Less Than) – This condition returns a search result if the first expression is less than the second
expression

476 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

• >= (Greater Than or Equal To) – This condition returns a search result if the first expression is greater
than or equal to the second expression. This condition has better performance than the BEGINS condition.
• <= (Less Than or Equal To) – This condition returns a search result if the first expression is less than or
equal to the second expression.
• BEGINS (Starts with the entered value) – This condition is useful in a WHERE phrase that specifies which
records should be retrieved from within a block of records. This condition is different from the MATCHES
condition, which requires all records be reviewed by the search query.
• MATCHES (Is the same as the entered value) – A character expression you use to search on character
strings. This can include a constant, field name, variable name, or expression whose value is a character.
Note the character expression cannot have any trailing blanks; for example, “abc” does not match “abc
”.
When the Condition Value is active, users can enter asterisks (*) as wildcard search values; this indicates
any group of characters works for the search results – including a null group of characters. A period (.) can
also be used to indicate any single character can be used in that position. If you want these characters to
be literal values instead of wildcard values, enter a tilde (~) value. For example, “~*a~.b” is a match for
“*a.b”. Enter a double tilde (~ ~) to make the match pattern a literal quoted string in a procedure file.

The application uses sort code values to prioritize how it


gathers search results. All uppercase letters sort before
all lowercase letters, so the lowercase records are greater
than the uppercase. For example, a is greater than Z, but
it is less than b.

7. Use the Criteria Type drop-down list to define the input field type that displays on the quick search.
Depending on the criteria type, a different field displays on the quick search form. In this example, select
the Prompt type. Available options:
• Prompt - Users directly enter search input values through this field. These values are then calculated
against the Condition value to generate the search results. If you use the Prompt type on a quick search,
it cannot be used as a data entry validation tool. The Validation Only check box is not available on the
Detail sheet.

Each quick search must have at least one prompt field.


If you do not have at least one prompt field as a search
option, users will receive an error message when they
attempt to launch your quick search.

• Constant - Users define a fixed value for the current criterion through this field. The quick search then
uses this fixed value to gather the search results. For example, you create a criterion that uses a constant
value of Customer_State = “MN”. This criterion causes the quick search to only find and select customer
records that have Minnesota addresses.
• Value List - This type is a field that displays a drop-down list. When you select this type, you must create
the values that display on this list using Quick Search Value Items; these items are explored later in this
section.
• Radio Set – Use this type to create a set of radio buttons for the quick search. When you select this
type, you define the radio buttons using Quick Search Value Items; these items are explored later in this
section.

8. The Criteria Value list defines the return value used to filter the search results. This is an optional value and
is active when you select the Constant option from the Criteria Type list. All the columns found on the BAQ
that were selected on the Detail sheet display.

10.2.700 477
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

9. If you want this search criterion to ignore null records, select the Filter On Null check box. This causes the
quick search to filter records that have a null value in the selected Criteria Column.
However if you want null records to display, clear this check box; only records that have a blank value display
within the results. For example, if the criterion searches by Customer_State and you clear this check box,
only customer records with blank State fields appear in the search results.

The Filter On Null check box is available when the Criteria


Column is a character field or a datetime field.

10. When you finish creating a search input field, click Save on the Standard toolbar.

11. The next search input field you create is a series of radio buttons you use to filter the quick search results
on the Manufactured, Purchased, and Sales Kit part types. To create these radio buttons, from the New
menu, select New Quick Search Criteria.

12. For this Criteria Column, select the Part_TypeCode value.

478 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

13. Enter the Caption you want to display. In this example, enter Part Type.

14. You want the search results to display the part records that match each radio button’s values. From the
Condition list, select = (Equal To).

15. From the Criteria Type list, select Radio Set.

16. Next you must define the radio buttons that display on the search form. To do this, from the New menu,
select New Quick Search Value Item.
The Value Items grid displays.

17. Enter the Display Member you want to appear next to the radio button. In this example, enter
Manufactured.

18. Now enter the Value Member used against the records to filter the search results. In this example,
manufactured parts use a value member of M, so you enter this value in this field.

To find out the value members used by the database,


launch the Data Dictionary. To learn how to use this
program, review the Business Activity Queries chapter.

19. To create a new row, press <Tab> . Add all the radio buttons you need. In this example, two other part
types are available, Purchased (P is their value member) and Sales Kit (K is their value member).

20. When you finish, click Save.

21. You need to create one more search input field that limits the results directly by part number. From the
New menu, select New Quick Search Criteria.

22. Because this search input field filters the results based on part number, from the Criteria Column list, select
Part_PartNum.

10.2.700 479
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

23. In the Caption field, enter Part Begins With.

24. From the Condition list, select BEGINS.

25. Because users directly enter values in this field, from the Criteria Type list, select Prompt.

26. Click Save.

You have now finished creating the search input fields that display on this quick search form.

480 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

Test a Quick Search

Always test your quick search to make sure it is working properly. To do this, use a special command from the
Actions menu.

1. From the Actions menu, select Test Quick Search.

2. Your quick search program displays. Use the search input fields to verify the quick search works correctly.

10.2.700 481
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Display a Quick Search

Users have a number of ways to launch your quick search. You can launch quick searches from within a related
search program, from a context menu, or directly through a search button. This section explores these various
launch methods.

Quick Search Tab

All quick searches that query data related to a standard search program appear on a search’s Quick Search sheet.
If multiple quick search options are available, users can select the quick search they want to display.

1. Launch the search program by clicking its specific search button. In this example, click the Part button in
the Part Maintenance program.

2. The search program displays. In this example, it is the Part Search program.

482 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

3. Click the Quick Search tab.

4. All the quick searches associated with the current search program display within the Quick Search grid.

Be aware that if you display the Quick Search Tab on a


search form (program) and then create new quick search
options, these new options do not immediately display
on the Quick Search Tab grid. To add these quick searches,
close the search form and its parent program. Now
re-launch the parent program and the search form. When
you display the Quick Search Tab, your new quick searches
appear as expected.

5. Highlight the quick search you want to use. In this example, you select the SerialTracked quick search.

6. Click the Search button.

7. The quick search program displays.

10.2.700 483
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Context Menu Options

Quick searches can also display in two locations on a field’s context menu. They can launch from the default list
that displays at the top of a context menu; they can also display on a Quick Searches sub-menu.
To place a quick search on the default list:

1. Return to Quick Search Maintenance.

2. Click the Quick Search ID button to search for and select the quick search you wish to modify.

3. Select the Context Default check box.

4. Click Save.

484 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

5. Return to Part Maintenance.

6. Right-click the Part field.

7. The Context Menu displays.

8. The quick search appears within the list of the default Open With programs. Select this command so that
the quick search displays.

All the default Open With programs display in alphabetical


order.

Default Search Program

You can also set up the quick search to become the default search program. This causes your quick search to
display instead of the original search program.

1. Return to Quick Search Maintenance.

10.2.700 485
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

2. Click the Quick Search ID button to search for and select the quick search you wish to modify.

3. Select the Base Default check box.

4. Click Save.

5. Return to Part Maintenance.

486 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

6. Click the Part button.

7. The Serial Tracked Parts search program displays.

10.2.700 487
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

You can also use a keyboard shortcut to display a quick


search selected as the Base Default for a field. To do this,
place your cursor inside the field, then press <Ctrl> + S.
The default search program displays.

Business Activity Query Searches

Business Activity Queries (BAQ) are used throughout the application to search for related data. You create BAQ
Searches in the Business Activity Query program by selecting “Like” columns. When fields in your query are
selected as “Like” Columns and this same field is used for searching in various programs, the BAQ becomes an
option within the search program.
You can indicate data from your query is available to all users searching for related data on the BAQ Search sheet.
You select fields from the Available “Like” Columns list and move them into the BAQ “Like” Columns list.
Available features:
• The Available “Like” Columns list contains all the fields selected for your query on the Display sheet.
• The BAQ “Like” Columns list displays the items you move over from the Available “Like” Columns list. Users
searching for information similar to the data contained in the BAQ “Like” items can access your BAQ Search.
Many standard search programs throughout the application contain a BAQ sheet that makes your query available
when users search for related data.

You cannot use system queries (beginning with the letter z)


for BAQ Searches because you cannot modify them. However,
you can copy a system query and then select “Like” columns
to be used on the BAQ Search sheet. To learn how to copy
and modify an existing BAQ, refer to the Modify an Existing
Query section in the Business Activity Queries chapter.

Enable BAQ Search Fields

In the previous chapter, you created a new query called EPIC03-SalesInfo that displays sales order information.
You decide you want users to access this query from the Customer Maintenance and Sales Order Entry programs
so they can look up data related to customer and sales order numbers.
Menu Path: System Management > Business Activity Queries > Business Activity Query

This program is not available in Epicor Web Access.

To enable fields in a query for use in BAQ Searches:

1. In the Query ID field, enter the query. In this example, you enter EPIC03-SalesInfo.

488 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

2. Verify the Shared check box is selected. The query must be shared in order for your users to access this
BAQ from a search form.

3. Click the BAQ Search tab.

10.2.700 489
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

4. Select the “like” columns used for the BAQ search. In this example, you select the Customer.CustID field in
the Available “Like” Columns list.

5. Click the Right Blue Arrow button.

490 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

6. The selected field moves to the BAQ Search “Like” Columns list.

7. In this example, you also select the OrderHed.OrderNum field and move it to the BAQ Search “Like”
Columns.

The sequence in which you select columns for display on


the BAQ search is important. When the BAQ is run, the
application uses the first column that shares the same
LIKE value as the search field’s LIKE value to return values.
This can cause unexpected results. For example, if the
search field is Part.PartNum and the first column in the
BAQ sequence that has a Like value is the
GlbPart.GlbPartNum column, the search uses this column
to pull return values. If this LIKE column has no value, the
BAQ Search will return all records which have no value in
this column.

8. Click the Save button on the Standard toolbar to save the query.

Use a BAQ Search

Once the BAQ Search information is saved, you can now leverage this BAQ in searches that use the Customer
ID and the Sales Order Number fields. For example, this query is now available when you search for sales orders

10.2.700 491
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

in Sales Order Entry and when you search for Customer IDs within Customer Maintenance. During this example,
you launch the BAQ Search within Sales Order Entry.
Menu Path: Sales Management > Order Management > General Operations > Order Entry

1. Click the Sales Order button to launch the Sales Order Search form.

2. Select the BAQ sheet.

3. Select CustomerOrders.

4. Click the Search button.

5. The Search Results grid displays your query data.

492 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

Advanced Searches

An Advanced Search is a dashboard you access to search for related data from a standard search window.
The Advanced Search functionality is designed around the concept of “Like” columns. Similar to the “Like”
columns used in a BAQ Search, the Advanced Search also uses “Like” columns; however, the data displays as a
Dashboard and opens in a separate window. You can then use the dashboard to search for specific data, select
a record, and pull the record back to the original program from which you were searching.
Advanced Searches are available wherever you can launch a search window. You launch these programs either
by clicking a search button or from a context menu.

This section of the guide reviews how to access and use an


Advanced Search. For directions on how to create an Advanced
Search, refer to the Dashboards chapter.

10.2.700 493
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

Use an Advanced Search

Advanced Searches are accessed through the search button in many programs or through a field’s context menu.
In this example, the Sales Order Entry program is used to demonstrate how you can access an advanced search.
Menu Path: Sales Management > Order Management > General Operations > Order Entry

1. Click the Sales Order button.

2. Select the Advanced sheet in the Sales Order Search window.

3. Notice a dashboard has been set up as an Advanced Search.

4. Select FulfillmentWBSearch and click the Search button.

5. The Fulfillment Workbench Search dashboard opens in a new window on your workstation.

6. You can now use the dashboard to search for specific records using the criteria available on the window.
In this example, you want to search for sales orders for the Distribution Product Group. You select Distribution
from this list.

7. Click the Search button to retrieve the records that match the criteria.

8. The results display in the Open Sales Order Release Search grid.

9. Once you find the record for which you are searching, select it in the grid.

10. Click OK.

11. The record selected in the dashboard displays in Sales Order Entry and you can now modify the sales order
as you need.

12. You can also right-click a field to access a Search (and any defined advanced searches) from the context
menu.

Named Searches

Use a Named Search to create a series of pre-set search options. In the Sales Order Search program, for example,
you can create a Named Search that only pulls in open orders created for Bill To customers. You could also create
a Named Search that automatically launches a BAQ Search or a Quick Search.
You use named searches in several ways. You can launch these searches manually from the Named Search
drop-down list within each search program. A specific Named Search option can be the default for the search
program; each time you launch the search, the Named Search options display. You can also set up Named
Searches to automatically populate data within either the search program or its parent program.

Create a Named Search

To create a named search:

1. Launch the Sales Order Search program.

494 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

2. Click the Named Search button.

3. The Named Search Options window displays.

10.2.700 495
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

4. Navigate to the Detail > Defaults sheet.

5. Click New.

6. Enter a Named Search ID for your new named search. In this example, you want to create a search that
pulls open sales orders and sorts them by their Purchase Order Numbers. Enter OPEN in this field.

7. In the Description field, enter Open Sales Orders.

8. The Application field displays the program for which you are creating the named search. In this example,
Erp.UI.SalesOrderEntry.dll displays.

9. The Search Form field displays the name of the search program being modified. In this example, Sales
Order Search displays.

10. Select a Search Type for this named search. Available options:
• Basic Search – Use this search type to modify the default values on the search program’s Basic sheet.
When you select this option, the search form’s Basic sheet displays.
• BAQ Search – Use this search type to select a Business Activity Query to populate the named search.
To learn how to create these search programs, review the BAQ Searches section in this chapter.
• Quick Search – Use this search type to select a Quick Search that populates the named search. To learn
how to create these search programs, review the Quick Searches section found in this chapter.

496 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

11. If you select either the BAQ Search or Quick Search type option, the Search Using drop-down list displays.
This list displays all the BAQs or Quick Searches available for this search program. Select a search option you
want from the list.

12. In this example, however, you are defining options for the Basic Search type.

10.2.700 497
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

13. When you select this Search Type, the Basic sheet from the current search program displays.

14. Enter the default values you want for this named search. In this example, you want the results sorted by
purchase order, so from the Sort By field, select PO Number. You also want only open orders created for
sold to customers to display; these business entities are the customers that purchased the goods. Bill To
customers are the business entities who pay for the goods.

15. Click Save.

Each search program has different options on its Basic


sheet. These Basic sheet options only display for you as
an example.

Named Search Details

Now you can select several options for the named search. These options affect how the named search runs when
it activates. To define these options:

1. Navigate to the Detail > Options sheet.

2. Select the Default check box if you want this named search to be the default for the current search program.

3. When the Default check box is selected, the Auto Execute check box becomes available. Selecting this
check box causes the search program to run when the search program launches, automatically populating
the Search Results grid with data.

4. When the Auto Execute check box is selected, the Unpin Criteria Sheet check box becomes available.
Selecting this check box causes the main search sheet to automatically hide; only the populated Search
Results grid displays.

498 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

5. When the Return All Rows check box is selected, the Search Results grid displays all the data that matches
the options within the named search.

Due to web browser limitations, this option is not


supported in Epicor Web Access, where search results are
always paged.

6. If you clear the Return All Rows check box, however, the Maximum Rows Returned field becomes available.
Enter the highest number of rows you want to display within the Search Results grid. In this example, this
named search displays a maximum of 1,000 records (rows).

7. Select the Single Value Auto Select check box to indicate that if the search program only locates one
record, this record automatically populates within the maintenance or entry program.

When you activate both the Auto Execute and Single


Value Auto Select check boxes, the search window never
appears as only one record loads into the program.
Because of this, you cannot access the search interface.
If you need to edit the named search, hold down the Alt
key as you launch the program. The original search form
displays and you can then launch the Named Search
Options window.

8. When you finish defining your options, click Save.

9. Close the Named Search Options window.

10. You can now see this search program in action. Click the Sales Order button.

10.2.700 499
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

11. The Sales Order Search window appears, using the named search options you selected. Notice in this
example, the search program automatically populates the Search Results grid with open orders, sorting
them by PO Number.

12. It also hides the Search program’s main sheet; these options are now a sheet at the top of this window.

Each time you launch this search program, it displays using these options.

Auto Populate Data

You can also personalize each program to automatically load in all the records selected through a named search.
You can then immediately populate a maintenance or entry program with the data you want.
To personalize a program to do this. In this example, you use Sales Order Entry:

1. From the Tools menu, select Options.

500 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

2. The Options window displays.

3. Notice the As the Form Opens group box. The options in this group box define some actions that run each
time you launch the program.

10.2.700 501
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

4. Select the Auto Populate Data radio button. This indicates you use a named search to automatically
populate the current program with records.

5. The drop-down list below the Auto Populate Data radio button becomes active. All the named searches you
have created for this program display on this list. In this example, you select the OPEN named search.

6. Click OK.

7. Now close and reopen the Sales Order Entry program you just personalized.

8. Now each time you launch this program, all the open sales orders automatically populate within the program.
You can use the Navigation toolbar to find and select the order you need.

Auto Load Search

You can define a similar default action using the Auto Load Search option. You also set up this value within the
Options window.

1. From the Tools menu, select Options.

502 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

2. The Options window displays.

3. Select the Auto Load Search radio button. This indicates you want the search program to automatically
display each time you launch the program.

4. The drop-down list below the Auto Load Search radio button becomes active. All the named searches you
have created for this program display on this list. In this example, you select the OPEN named search.

10.2.700 503
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

5. Click OK.

6. Close and reopen the Sales Order Entry program you just personalized.

7. Now each time you launch this program, the Sales Order Search program automatically displays.

8. Notice that, by default, the named search’s options display within the Basic tab.

504 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

Override Search Options

You can always restore the original search program. To do this, press the <Shift> button on your keyboard and
then launch the search program. The original search program appears – displaying its Basic sheet. You can then
select any Named Search, BAQ Search, Quick Search, or Advanced Search created for this search program.

Data Tag Searches

Use Data Tag Searches to find and select records grouped together by private or shared tags.
Tags are unstructured text values that provide a way to associate otherwise unrelated records so that you or
other users can search for them. For example, you may have a group of customers you want to review on a
regular basis. You can create a private data tag for your important customers called “XXXImportant” (where
“XXX” is your initials) and use the Data Tag Search from Customer Maintenance to retrieve all the records at the
same time. You might also want to group a number of sales orders for review by someone else. You can apply
a public data tag called OrderReview that a sales manager can use from Sales Order Entry.
Private data tags are associated with your user account. Other users cannot retrieve records using your private
tags and, likewise, they cannot see or edit them. Public data tags can be viewed and used in Data Tag Searches
by all users. You can add as many data tags as needed to a record, each separated by a space. However because
the tags are space delimited, you cannot include a space as part of a data tag.

Add Data Tags to a Record

You can add data tags to any record throughout all the programs in the application. In this example, Customer
Maintenance is used to demonstrate how you can add data tags to a record.
Menu Path: Sales Management > Order Management > Setup > Customer

1. Click the Customer search button and retrieve one or more records.

10.2.700 505
Chapter 4 | Searches Epicor ICE 3.2 Tools User Guide

2. Right-click the main field; from the context menu, select Tag Record.

3. The DataTags window displays.

506 10.2.700
Epicor ICE 3.2 Tools User Guide Searches | Chapter 4

4. To add a private data tag—one for your use only—enter the data tag value into the My Tags field. If other
tags are already in the field, add a space and then the new tag.

5. To add a shared data tag—one that can be used by others—enter the data tag value into the Shared
Tags field.

6. Click OK.

7. You return to the Customer Maintenance window. You do not need to save the record for the tag to be
in effect.

Add Data Tags to Records in a Grid

To tag records in a grid:

1. To add a tag to some, but not all, of the records in a grid, select one or more records. Yo