Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Quick

...

Background

...

Sometimes,

...

it

...

isn't

...

possible

...

to

...

be

...

able

...

to

...

pre-define

...

your

...

query

...

as

...

a

...

resource

...

or

...

an

...

input

...

to

...

report.

...

Sometimes,

...

it

...

becomes

...

necessary

...

to

...

generate

...

your

...

query

...

(whether

...

it's

...

SQL,

...

MDX,

...

or

...

whatever)

...

using

...

a

...

programming

...

language

...

(such

...

as

...

javascript).

...

Examples

...

of

...

this

...

requirement

...

may

...

involve:

...

  • Based

...

  • on

...

  • user

...

  • inputs,

...

  • a

...

  • query

...

  • may

...

  • require

...

  • a

...

  • join

...

  • to

...

  • one

...

  • or

...

  • more

...

  • tables

...

  • If

...

  • there

...

  • are

...

  • several

...

  • optional

...

  • inputs

...

  • that

...

  • effect

...

  • the

...

  • way

...

  • the

...

  • query

...

  • is

...

  • constructed.

...

What

...

This

...

Tech

...

Tip

...

Demonstrates

...

This

...

tech

...

tip

...

goes

...

beyond

...

simply

...

demonstrating

...

building

...

a

...

dynamic

...

SQL

...

query

...

in

...

a

...

javascript

...

rule.

...

Here

...

are

...

the

...

highlights:

...

  1. Dynamic

...

  1. SQL

...

  1. generation

...

  1. Iterating

...

  1. over

...

  1. a

...

  1. result-set

...

  1. in

...

  1. a

...

  1. javascript

...

  1. rule

...

  1. to

...

  1. get

...

  1. the

...

  1. column

...

  1. title

...

  1. based

...

  1. on

...

  1. user

...

  1. input

...

  1. Defining

...

  1. a

...

  1. message-field

...

  1. for

...

  1. the

...

  1. column

...

  1. name

...

  1. in

...

  1. a

...

  1. report

...

  1. Defining

...

  1. a

...

  1. message-field

...

  1. for

...

  1. the

...

  1. selected

...

  1. region

...

  1. in

...

  1. a

...

  1. report.

...

Sample

...

Use

...

Case

...

Instead

...

of

...

just

...

coding

...

up

...

a

...

sample,

...

I

...

wanted

...

to

...

make

...

sure

...

I

...

had

...

a

...

reasonable

...

use

...

case

...

for

...

the

...

technical

...

tip.

...

The

...

use

...

case

...

was:

...

  1. Gather

...

  1. user

...

  1. input.

...

  1. Based

...

  1. on

...

  1. the

...

  1. users'

...

  1. input,

...

  1. run

...

  1. a

...

  1. query

...

  1. that

...

  1. either

...

  1. returns

...

  1. information

...

  1. on

...

  1. departments,

...

  1. or

...

  1. information

...

  1. on

...

  1. position

...

  1. titles.

...

  1. Do

...

  1. this

...

  1. using

...

  1. only

...

  1. one

...

  1. report

...

  1. specification

...

  1. and

...

  1. one

...

  1. action

...

  1. sequence.

...

Setup

...

and

...

Requirements

...

Before

...

beginning

...

this

...

tech

...

tip,

...

please

...

make

...

sure

...

you

...

have

...

downloaded

...

and

...

installed

...

the

...

following:

...

...

...

...

...

  • version

...

  • 1.1.6

...

  • or

...

  • later.

...

...

...

...

...

  • version

...

  • 1.1.6

...

  • or

...

  • later.

...

...

...

...

...

  • running

...

  • locally,

...

  • and

...

  • the

...

  • hypersonic

...

  • database

...

  • running

...

  • locally

...

  • with

...

  • the

...

  • SampleData

...

  • database,

...

  • version

...

  • 1.1.6

...

  • or

...

  • later.

...

Query

...

Analysis

...

This

...

action

...

sequence

...

will

...

compose

...

the

...

following

...

queries:

...


If

...

the

...

user

...

selects

...

the

...

department

...

report,

...

the

...

query

...

will

...

look

...

like

...

this:

Panel
Wiki Markup

select {color:red}department{color} as column1, sum(actual) from quadrant_actuals where region = '{region}' group by {color:red}department{color} order by actual desc

If

...

the

...

user

...

selects

...

the

...

position

...

report,

...

the

...

query

...

will

...

look

...

like

...

this:

Panel
Wiki Markup

select {color:red}positiontitle{color} as column1,
 sum
 sum(actual) from quadrant_actuals where region = '{region}' group by {color:red}positiontitle{color} order by actual desc

Note

...

that

...

in

...

both

...

cases,

...

the

...

first

...

column

...

is

...

selected

...

and

...

renamed

...

as

...

column1.

...

This

...

is

...

an

...

important

...

thing

...

to

...

note

...

because

...

when

...

the

...

report

...

is

...

built

...

using

...

the

...

Report

...

Design

...

Wizard,

...

column1

...

will

...

be

...

the

...

column

...

that's

...

used

...

for

...

getting

...

at

...

the

...

data.

...

Building

...

the

...

Report

...

Using

...

the

...

Report

...

Design

...

Wizard

...

For

...

the

...

purposes

...

of

...

laying

...

out

...

a

...

quick

...

report,

...

it

...

doesn't

...

matter

...

which

...

query

...

we

...

choose

...

-

...

the

...

result

...

will

...

be

...

the

...

same.

...

The

...

following

...

screenshots

...

walk

...

you

...

through

...

the

...

steps

...

and

...

options

...

to

...

choose

...

in

...

the

...

Report

...

Design

...

Wizard.

...


Run

...

the

...

Report

...

Design

...

Wizard

...

(

...

execute

...

the

...

reportwizard.bat

...

|.sh

...

file).

...

(If

...

you

...

are

...

not

...

familiar

...

with

...

the

...

Report

...

Design

...

Wizard,

...

review

...

the

...

Report

...

Design

...

Wizard

...

User's

...

Guide

...

before

...

going

...

forward.)

...

Info
titleImportant Note

In Step 5, "Describing Column1",

you'll

note

that

the

display

name

was

set

to

$(columnTitle).

In

Step

5,

"Describing

Actual",

you'll

see

the

display

name

is

set

to

Actual.

This

is

the

only

change

we

will

make

to

this

report

definition.

Otherwise,

...

the

...

report

...

defaults

...

were

...

used

...

to

...

generate

...

this

...

simple

...

report.

...

STEP

...

1:

...

Report

...

Title

...

and

...

Description