training course #1: query designing training course #1: query designing please view in slide show...

86
Training Course #1: Training Course #1: Query Designing Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Upload: makena-sayers

Post on 30-Mar-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Training Course #1:Training Course #1:

Query DesigningQuery Designing

Training Course #1:Training Course #1:

Query DesigningQuery Designing

Please view in slide showPage Down/Up or mouse click to navigate through the show

Page 2: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

An opportunity overdue for closingAn opportunity overdue for closing Sales reps with fewer than 6 activities this Sales reps with fewer than 6 activities this

weekweek A client whose credit status was changedA client whose credit status was changed

KnowledgeSync lets you design queries. The only KnowledgeSync lets you design queries. The only requirement for designing queries is a thorough requirement for designing queries is a thorough

understanding of an application’s database schema.understanding of an application’s database schema.

Queries can check for virtually any condition of data in an Queries can check for virtually any condition of data in an application, such as:application, such as:

A “query” identifies a condition of data within an A “query” identifies a condition of data within an application that should cause an event to trigger.application that should cause an event to trigger.

Queries

Page 3: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

An event may use multiple queries to check for a complex An event may use multiple queries to check for a complex combination of conditions, such as:combination of conditions, such as:

Checking for customers who have purchased < $10,000 Checking for customers who have purchased < $10,000 over the last year, but have called into support more over the last year, but have called into support more

than 12 times.than 12 times.

A query is one component of an event. A single event A query is one component of an event. A single event may use a single query, or it may use multiple queries. may use a single query, or it may use multiple queries.

Queries & Events (I)

Page 4: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

An event may also use multiple queries to check for An event may also use multiple queries to check for conditions across multiple applications, such as:conditions across multiple applications, such as:

An event that looks for customers who have pending An event that looks for customers who have pending sales sales

(in a CRM application)(in a CRM application)

But are also on credit hold But are also on credit hold (in a financial application)(in a financial application)

Queries & Events (II)

Page 5: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

A single query may also be used in multiple events. A single query may also be used in multiple events. For example, a query that checks for pending sales > ‘x’ For example, a query that checks for pending sales > ‘x’

dollars may be used in: dollars may be used in:

An event that looks for sales > $10,000An event that looks for sales > $10,000and inand in

An event that looks for sales > $25,000An event that looks for sales > $25,000and inand in

An event that looks at sales > $50,000An event that looks at sales > $50,000

Queries & Events (III)

Page 6: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Designing a Query (click here)Designing a Query (click here)

Please select the component of KnowledgeSync Query Please select the component of KnowledgeSync Query Designing that you would like to learn about next: Designing that you would like to learn about next:

Designing “Linked” Queries (click here)Designing “Linked” Queries (click here)

What to Do Next (click here)What to Do Next (click here)

Query Designing Helpful Hints (click here)Query Designing Helpful Hints (click here)

ExitPresentation

Tour Menu

Page 7: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

All query designing is done in the KnowledgeSync Event All query designing is done in the KnowledgeSync Event Manager. Manager.

Log into that module (username “Admin”, no password).Log into that module (username “Admin”, no password).

You will be presented with a window like the following:You will be presented with a window like the following:

How to Begin

Page 8: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Return to

Tour Menu

We will design a query for the “Training” application.

Click on the plus sign (+) next to the “Training” Application in order to display the sub-branches beneath it.

Page 9: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

We’ll be working in the Query Definitions branch.

Click on the Query Definitions branch to display a listof pre-defined queries for the Training application.

Return toTour Menu

Page 10: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Queries can be divided into three groups:

• Record-Level Queries

• Aggregate Queries

• Value-Change Queries

Return toTour Menu

Page 11: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Record-level queries are those that aretriggered by the condition of individualdatabase records.

These queries look for specific conditionsin database records, and, if those conditionsare met, the query is “triggered.”

(The queries with the arrows pointing atthem are record-level queries.)

Return toTour Menu

Page 12: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Aggregate queries are those that are triggeredby a group of records that meet a certain threshold.

These queries look for specific conditions indatabase records, then perform an aggregatetest on that group of records, and, if both the record-level and aggregate conditions are met,the query is “triggered.”

(The queries with the arrows pointing atthem are aggregate queries.)

Return toTour Menu

Page 13: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Value Change queries are those that are triggered when a record’s value has been changed.

These queries are very useful, as they enable you to detect when someone haschanged the value of any field in an application.

(The queries with the arrows pointing atthem are value-change queries.)

Return toTour Menu

Page 14: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

1) The list on the right shows examplesof the types of conditions that you can detect using a query.

2) Click on the “New Query Definition”button at the top-left of this windowto create a new query . . .

Return toTour Menu

Page 15: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

When designing a query, the first thing youspecify is the query’s name and whether itcan be used in an event.

Return toTour Menu

Page 16: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The “Active” flag simply indicates that thisquery is eligible to be used in one or moreevents.

Return toTour Menu

Page 17: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync automatically displays all of thetables from the corresponding application.

The first step in designing a query is to identifywhich tables contain the information youwish to test against for certain conditions.

You simply click on the table name you wish toinclude in this query, and then click on the “Add Table” button.

Return toTour Menu

Page 18: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query will be designed to retrieve any ordersthat were picked today but have not been invoiced.

We select the “Order Header” table since that is where general order information is stored.

We select the “AR Customer” table since that lets usretrieve the customer’s name. (The “orders” tablestores only the customer’s account number.)

And we select the “Salesperson” table since that letsus retrieve the name of the salesrep associated tothe order.

Return toTour Menu

Page 19: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

1) If multiple tables are selected, KnowledgeSync’s“intelligent linking wizard” helps you link (or join)the tables together.

2) It’s VERY important which table you select FIRST whencreating these links.

You MUST specify the query’s primary table – that is, thetable that contains the records that will cause this queryto trigger.

Since this query is designed to retrieve “orders”, the “Orders” table must be the first table we link from.

Return toTour Menu

Page 20: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Click on the “Add Table Link” button.

Return toTour Menu

Page 21: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Since this is our first link, we start out bychoosing the “Orders” table.

Return toTour Menu

Page 22: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync automatically fills in the “Link to”table name, which we can either keep or override.

Return toTour Menu

Page 23: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Tables are linked together via a common field (column)of data. Once we specify the name of the column in the“Orders” table that contains the customer number, KnowledgeSync automatically searches for (and loads)the corresponding field from the “Customer” table.

(And the “Link Type” automatically defaults to “Left Outer Join” which is the standard linking method inbusiness applications.)

Return toTour Menu

Page 24: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Once we save our first link, we are ready to followthe same steps to link the “Orders” and “Salesreps”tables.

Return toTour Menu

Page 25: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Note that if the database (or ODBC driver) that you areusing does not support standard linking syntax, you canclick on the checkbox below and manually enter the SQL“from clause” that links the tables together.

Return toTour Menu

Page 26: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The “Columns” tab is where you select the fields ofdata that you might wish to include in an outgoing alert message and in an event’s “response actions”when this query’s conditions are met.

The list titled “Available Columns to Query” at the top of this tab is a list of all the fields of data fromthe tables you selected previously.

Return toTour Menu

Page 27: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

For example, if you wish to use the customer’s “ordernumber” in an alert message or response action, you simply highlight the corresponding field in the list at the top of this window and click on the buttoncalled “Add Column to Query.”

Return toTour Menu

Page 28: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

We would continue adding fields until we had allthe information that we might wish to use inan event’s alert messages or response actions.

Return toTour Menu

Page 29: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

When creating a record-level query, the “Column Type”field for all the columns is always left as “Normal.” Thismeans that KnowledgeSync will retrieve the actualvalue of that column.

Return toTour Menu

Page 30: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

When creating an aggregate query, you can choosefrom five additional “Column Types”.

Typically, an aggregate query checks for conditionssuch as:

-- More Than $50,000 in sales last week-- An average discount percent greater than 7%-- More than 25 support calls this week

Here are a few examples:

Return toTour Menu

Page 31: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query uses an aggregate to “summarize” (or total)the forecast sales per salesrep.

This first column selected indicates what field will haveits value summarized.

The second column selected indicates how the summarizedtotal will be “grouped.” (Per salesrep)

If the second column had been “company name” insteadof “salesrep”, the sales would be totaled per companyinstead of per salesperson. (And if “company” is chosen as a third column, you will get a list showing the forecast sales per salesrep and then – within each salesrep – youwould see the sales further broken down by company.) Return to

Tour Menu

Page 32: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query identifies any support reps whose average callduration is greater than ‘x’ minutes.

This first column indicates that the average call time will bedetermined.

The second column indicates that the average time will be grouped “per support rep.”

If the second column had been “customer name” insteadof “support rep”, the average call duration would be calculated per customer instead of per support rep.

Return toTour Menu

Page 33: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query “counts” the number of activities per salesrep andidentifies anyone who has fewer than ‘x’ scheduled activities.

When using the “count” function, you should always count the column that uniquely identifies each record within a table (e.g., order ID, customer ID, activity ID, etc.).

The second column indicates how the counted records willbe “grouped.” (Per salesrep)

If the second column had been “activity priority” insteadof “salesrep name”, the activities would be counted per priority instead of per salesperson. (And if “priority” is chosen as a third column, you will get a list showing thenumber of activities per salesrep – broken down by priority.)

Return toTour Menu

Page 34: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Sometimes you’ll find that an application uses columnnames that are cryptic or difficult to understand.

In some applications, column names with multiple words are all squeezed together.

Using the “Customized Name” field, we can change thedefault names to something more intuitive, or morereadable.

Return toTour Menu

Page 35: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Note how we have modified the column names to make them clearer.

(Since some ODBC drivers don’t like blank spacesin a column’s customized name, you should use the underline character to separate words.)

Return toTour Menu

Page 36: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Notice the “Unique” column.

When KnowledgeSync finds a record that meets aquery’s criteria, the record is considered “triggered.”

You need to tell KnowledgeSync how it can “remember” which records have been triggered.

This is what the “Unique” checkbox is for.

Return toTour Menu

Page 37: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Since the “Order Number” uniquely identifies each order,it will also allow KnowledgeSync to remember which order records have been triggered.

And so we place a checkmark in the “Unique” column for the Order Number field.

Return toTour Menu

Page 38: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Finally, note how you can create columns that usecalculations to derive entirely new values.

In this example, the query is multiplying an opportunity’s close probability times the forecastamount of the sale (and then is multiplying that totalby .01) to derive the “weighted value” of the sale.

Return toTour Menu

Page 39: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

When KnowledgeSync sends out an alert message,it can “roll-up” the details of multiple records intoa single message.

As a result, you need the ability to specify theorder in which the triggered records are displayed.

This is called the “sorting order.”

Return toTour Menu

Page 40: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

In the case of this query, we might want to list thematching orders according to their “order date,”with the earliest orders listed first.

Just like in the “Columns” tab, we can sort by any fields from the tables we selected.

In the “Sort Direction” field, we can choose either“Ascending” or “Descending.”

Return toTour Menu

Page 41: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

You can even specify “nested” sorting.

In this query, if multiple orders have the sameorder date, the orders will then be listed in thealphabetic order by the customer’s name.

Return toTour Menu

Page 42: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The “Filters” tab is the most important part of a query. It iswhere you specify what conditions have to occur in order forthe query to be “triggered.”

The way a filter works is for you to specify a field, (such as “order total”) an operator (such as “is greater than”) and acompare value (such as “1000” dollars).

Here’s how it’s done . . .

Return toTour Menu

Page 43: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The list of “Available Columns to Filter” lists all of thefields from the tables you selected for this query.

You start by selecting the field you wish to test for aspecific condition.

Return toTour Menu

Page 44: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

A filter can retrieve records that meet a certaincondition (“is”) or it can retrieve records that do not meet a certain condition (“is not”).

Return toTour Menu

Page 45: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync supports all standard operators,including checking for records with a “null” or blank value.

Return toTour Menu

Page 46: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

A filter’s “Compare Value” can contain differenttypes of values. For starters, you can comparethe value in a field against a constant value.

In this example, the order status must be equalto “Picked”.

Return toTour Menu

Page 47: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

You can compare the value in one field against the value in another database field.

In this example, note how the query is checking to see if an item’s “on-hand”quantity is less than its “re-order level”.

Return toTour Menu

Page 48: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

You can even compare the calculated value of two or more fields against the value of a constant, against the value of another database field, or against the value of another calculated field.

In this example, the filter is adding the numberof units on hand to the number of units on purchaseorder, and is then comparing that total to see if it isless than the quantity on back order plus the quantity on existing sales orders.

Return toTour Menu

Page 49: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync also lets you perform date-relatedcomparisons using an extensive list of “date variables”.

If you click on the list button that appears in this field,you’ll be presented with a window like the following . . .

Return toTour Menu

Page 50: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

And over on the left you can choose from a widevariety of “date substitution variables” so thatKnowledgeSync can automatically determine thedates that it should use in this query.

Return toTour Menu

Page 51: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

And so you can identify important business eventsthat occur “today”, “tomorrow”, “yesterday”, or evenfrom “last Monday” through “last Friday”.

You can even identify events that have (or have not)occurred within the past ‘x’ days or that will occurwithin the next ‘y’ days.

Return toTour Menu

Page 52: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync also lets you query the underlyingdatabase for a list of possible values for a field.

If you click on the list button that appears in this field,you’ll once again see the following window . . .

Return toTour Menu

Page 53: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Up in this field, you can display a list of validfield values from your underlying database.

Return toTour Menu

Page 54: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Lastly, you can “soft-code” a filter with a compare value of a question mark.

A compare value of “?” indicates that the value for this filter will be specified on the event level, when this query is used within an event.

The benefit of using the “?” as a filter compare value is that it allows a single query to be used in multiple events.

(E.g., this query could be used in one event that looks at orders shipped today, in another event that looks at orders shipped yesterday, and in a third event that looks at orders shipped last week.) Return to

Tour Menu

Page 55: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Although KnowledgeSync automatically identifieswhether a field contains character, date, or numeric data, you can change the way KnowledgeSync viewsthat data to create even more flexible query filters.

Return toTour Menu

Page 56: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

KnowledgeSync also provides the ability to groupfilters based on “and/or” relationships.

Depending on the type of grouping you wish to do,you can accomplish it either via linear “and/or”logic, or you can simply insert parentheses around the filters you wish to group together.

Return toTour Menu

Page 57: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

If you create filters whose value will be specified on theevent level (i.e., filters with a compare value of ‘?’), youcan specify the “prompt” that will appear on the event levelwhen a value needs to be supplied for this filter.

When this query is used within an event, the user creating the event will be prompted to enter a “selected product,” a “begin date range,” and an “end date range.”

Return toTour Menu

Page 58: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The button at the lower right is what enablesyou to configure a query to check a field to see if its value has been changed.

Return toTour Menu

Page 59: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The fields listed on the left are those that can bemonitored for a change to their value.

Return toTour Menu

Page 60: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The fields selected on the right are those that youhave chosen to be monitored for changes to their value.

It’s worth noting that KnowledgeSync can notonly determine when a field has had its valuechanged, but also determine when a field has hadits value changed to one or more specific entries.

Return toTour Menu

Page 61: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The “Sub Filters” tab is used only with aggregatequeries (such as testing for “more than 6 ordersshipped late last month.” Since this is a recordlevel query that uses no aggregate functions, this tab is left blank.

Return toTour Menu

Page 62: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Demo: Event Queries

The “SQL” tab lets you see what KnowledgeSync is doingbehind the scenes in this query. Without KnowledgeSync’sstep-by-step Query Designer, this is what you’d have to do manually to achieve the same results as the query.

(And it’s also worth noting that the checkbox at the lowerleft of this window gives technical users the ability to directlyedit the SQL syntax for this query, would they wish to do so.)

Return toTour Menu

Page 63: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Demo: Event Queries

The “Preview” tab lets you test the results of yourquery. This is a very useful way of ensuring that your query retrieves only the records you want it to.

This is the conclusion of the demonstration onhow queries are created. Click here to go backto the Tour Menu and explore other aspects ofQuery Designing.

ExitPresentation

Return toTour Menu

Page 64: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

In KnowledgeSync, a single eventmay use multiple queries

to identify complex conditions withina single application.

Send an alert about any clients with more than $250,000 in historical sales and have at least one open sales opportunity of at least $30,000.

For Example:

Linked Queries

Return toTour Menu

Page 65: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Linked queries may also be used tocreate events that combine data

across multiple applications.

Send an alert about any clients with pending sales opportunities (in a CRM application) and are on credit hold (in a financial application).

For Example:

Cross Application Linked Queries

Return toTour Menu

Page 66: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query #1:More Than $250,000 in Historical Sales . . .

Query #2:. . . have a Pending

Sale > $30,000

Query #1:Pending Sales (in a

CRM App) . . .

Query #2:. . . are on Credit Hold(in a Financial App) and

and

When using multiple queries, the first step isto identify the conditions you wish to check for

Clients With . . .

Clients With . . .

Identify the Conditions

Return toTour Menu

Page 67: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query #1:More Than $250,000

in Historical Sales

Query #2:And Have a Pending

Sale > $30,000

Query #1:Pending Sales (in a

CRM App)

Query #2:And Are on Credit Hold

(in a Financial App)

Contact.ClientID

Contact.ClientID

The second step is to identify the field (or fields) that link data from the two queries together

Clients With . . .

Clients With . . .

Account.AccountNo

Identify Common Field(s)

Return toTour Menu

Page 68: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Condition:Clients With >

$250,000 in Historical Sales and

a Pending Sale >$30,000

Filter:Query #2 Contact.ClientID is the same as the Query

#1 Contact.ClientID

The final step is to create a “filter” in query #2 that links it to query #1

Condition:Clients With Pending Sales and on Credit

Hold

Filter:Query #2

Account.AccountNo is the same as the Query #1

Contact.ClientID

Link Query #2 to Query #1

Return toTour Menu

Page 69: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Here’s an event that gets triggered if a client has a newsales opportunity created for them (in a CRM application)but happens to be on credit hold (in a financial application).

The first step is to review the query that checks for newsales opportunities in the CRM application . . .

Return toTour Menu

Page 70: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The first query that we need to design is one that identifies clients with newly-created sales opportunities.

Return toTour Menu

Page 71: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query retrieve all newly-created sales for each client.

Because we will be using this query to “feed” information intoa following query, we need to consider what field in this querywill link to a field in the second query.

In this example, we want to link clients in the CRM applicationwith clients in the financial application. Thus we will use the “ACCOUNT” field as the linking field.

(The linking field is always referenced by its “Customized Name”)

You can use any field to link one query with another.

Return toTour Menu

Page 72: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Aside from making a note of the linking field’scustomized name, there is nothing special thatwe need to do in this first query.

Return toTour Menu

Page 73: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Our next step is to design the “link to” query –this is the one that will receive data from thefirst query and use that data as further selectioncriteria.

Note that “link to” queries cannot be used alone;they are usable only when preceded by anotherquery that “feeds” them the appropriate data.

As a result, it is usually a good idea to identify a“link to” query by some unique text in its name.

Return toTour Menu

Page 74: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Like any other query, the “link to” query is designedto include the specific fields of data you require.

Return toTour Menu

Page 75: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Here’s the key to the “link to” query:

The first filter specifies that this query will retrieve only those clients on credit hold.

The second filter specifies that this query will retrieve only those customers (on credit hold) who were also retrieved by the first (or preceding) query.

And so, to link one query to another, all you need to do is:

1) Identify the two fields that link the queries together2) Select the first field as a column in query #13) Select the second field as a filter in query #2 and compare it to the customized

name of the linking field from query #1 (enclosed within “{}” symbols)Return to

Tour Menu

Page 76: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

There is one final step: choosing both the queries fora single event.

One word of warning: Be sure to choose the queriesin the right order. If the “link to” query is specifiedfirst, you’ll never get any matching records!

Return toTour Menu

Page 77: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query Tables:Query Tables:

You can select the same table multiple times. For You can select the same table multiple times. For example:example:

You have a query that checks for activities created by one salesperson and assigned to another. You want to send an alert message that contains both the creator’s name and the assignee’s name.

You choose the activity table and the salesrep table (the salesrep table contains the salesreps names.)

You need to link from the activity table to the salesrep table twice; once to get the creator’s name and once to get the assignee’s name. However, ODBC does not allow you to link to the same table name twice. You need to use a table alias.

In KnowledgeSync, you can select the same table name multiple times; after the first selection, KnowledgeSync will ask you to supply an alias name for the previously selected table.

You may now do your links.

Helpful Hints

Return toTour Menu

Page 78: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query Links:Query Links:

1. Order of Tables: A query’s primary table must be the first listed in the Links tab. For example, a query that retrieves orders that are shipped late uses the orders, customers, and salesreps tables. As you specify your links, be sure that the orders table is the first table in the first link you create.

2. Optimizing Processing: If you have a choice as to the order of the tables you are using, select the tables that retrieve the fewest number of records first. This means that successive filters on other tables will go that much faster.

3. Manual Linking: If you need to manually specify the linking syntax, simply type in everything that would follow the word “from” in a SQL statement. Do not include the word “from” in your statement.

4. Overriding the Link Type: In general, don’t do it unless you’re sure of yourself or have spoken with Vineyardsoft support.

Helpful Hints

Return toTour Menu

Page 79: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query Columns:Query Columns:

1. Editing Selected Columns: Once you have selected a column, you can edit it within the grid. You can create columns that include arithmetic expressions, SQL expressions, or columns that are calculations of multiple fields. Simply click next to the selected column name and start typing.

2. Customized Names: Different databases (and ODBC sources) handle customized names slightly differently. It is suggested that you not embed blanks within customized names, and that you not make them overly long.

3. Multi-Field Uniques: KnowledgeSync allows only a single column to be selected as a “unique.” If you have a table that uses multiple columns as the unique value, you can create a column that concatenates these two fields into one – and then identify that field as the unique column.

4. Add All Columns to Query: This button is very handy if you don’t know what data is stored in a table’s fields. Simply select the table in question, click on the “Add All Columns to Query” button and click on the Preview tab.

Helpful Hints

Return toTour Menu

Page 80: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Query Filters:Query Filters:

1. Editing Filter Columns: Probably the most powerful and little-known function within the Filters tab is the ability to edit a column once you have selected it for filtering. You can create filters that combine values from multiple fields, or that use SQL operators for even more sophisticated testing of conditions.

2. Checking for Blanks/Nulls: If you wish to check for a field value that is blank or null, you have two ways to do it. First, you can specify a filter using an operator of “null.” Secondly, you can specify a filter using an operator of “is equal to” and then place a blank space in the Compare Value field.

3. Date Ranges: If you would like to create a query that accepts a date range, it is suggested that you use two filters off of the same field (one filter testing date values “greater than or equal to” ‘x’ and another filter testing date values of “less than or equal to ‘x’).

The following slides illustrate some of the more interesting filter conditions.

Helpful Hints

Return toTour Menu

Page 81: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query has a filter that uses an SQL operator tocalculate the number of days between the currentdate and the date on which an order was placed.

Return toTour Menu

Page 82: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

This query has a filter that adds the number of units of aproduct that are on order from a supplier to the number of units that are in stock and checks to see if that total isless than the product’s reorder (or minimum) stock level.

Return toTour Menu

Page 83: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

And here is a query that subtracts the cost of a sale fromthe sale price and (thru a few other arithmetic functions)deduces the net profit percent.

Note that by using the ‘?’ in the Compare Value fields, thisone query can be used in many different events; each checking for a different percent range of net profit.

Return toTour Menu

Page 84: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Lastly, be aware that different databases (and ODBC drivers)support different operations and syntax in these query filters.

If you have questions about what operators you can use inyour filters, please contact the Vineyardsoft support team.

Return toTour Menu

Page 85: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

The best way to proceed from here is to start building The best way to proceed from here is to start building queries.queries.

1. Focus on Query Designing: Don’t worry about the events for now; build and preview a whole bunch of queries. Create record-level queries, aggregate queries, and queries that include more complex filters. Once you master query designing, the rest is a piece of cake!

2. Start Simple: You can always add tables, columns, and filters to a query. Start off by choosing just one table, a few columns, and one or two filters. Preview your results. If you like what you see, go on from there.

3. Use the Sample Database: If you don’t have easy access to an ODBC-compliant database, use the “KS_Sample.mdb” that is included in the KnowledgeSync data directory. It’s a mini-CRM database and is great for practice.

4. Don’t Forget the Tutorials: KnowledgeSync includes tutorials (and pre-configured “EventPaks”) for the sample application, Sage MAS 90/200/500, Sage CRM SalesLogix, Microsoft Dynamics GP (Great Plains), Microsoft Dynamics CRM, and many other applications.

Where to Go From Here

Return toTour Menu

Page 86: Training Course #1: Query Designing Training Course #1: Query Designing Please view in slide show Page Down/Up or mouse click to navigate through the show

Thank You

Vineyardsoft Corporation

800-850-8055

www.vineyardsoft.com

[email protected]

Return toTour Menu