How to make weekly through dynamic parameters

Description of Requirement

In the commodity trading system, users can not only look at the day's transactions, but also view a week / month / year in the case, also known as weekly / monthly / annual reports. Wherein the effect is shown in FIG weekly order information.
imagepng

How does it check out this week's date where the ordering information tables based on user input a date of it?

Implementation steps

1, parameter configuration

imagepng

Wherein, arg1 is the date entered by the user, corresponding to the common parameters;

arg2 is based on the start date of the week calculated arg1, corresponding to dynamic parameters, expressed as: pdate @ w (arg1);

arg1 arg2 is calculated based on the end date of the week, corresponding to the dynamic parameters, expressed as: pdate @ we (arg1);

Whenever there is an input when the date passed, arg2 and arg3 will be recalculated based on their expression, days of the week to give time and end time corresponding values ​​for the two data sets, the report calculations.

PS: pdate function instructions, see the appendix at the end articles.

2, the configuration data set

ds1:

SELECT orders. Order Date, orders.ORDER ID, order. Owner region, orders the owner of the city, order. Shippers FROM orders WHERE orders. Order Date>? AND orders. Order Date <?

And adding two data sets parameter references: arg2 and arg3.

ds2:

SELECT shippers. Company name, shippers. Shipper ID FROM Shippers

3, configuration report cells

imagepng

among them,

Expression is cell A2: = string (arg2) + "to" + string (arg3) + "orders"

A4 cell expression is: = ds1.select (Order date), display format: yyyy Year MM Month dd Day

Expression is cell B4: = ds1 order ID.

Cell C4 expression is: = ds1 owner area.

D4 cell expression is: = ds1 owner of the city.

E4 cell expression is:. = Ds1 shipper, the value of the expression is displayed ds2.select (company name, Shipper ID == value (), 1)

At this point, it completed the production of a weekly newspaper.

to sum up

Core key point is how to achieve weekly get the start time and end time of the week, this demand can be calculated by the dynamic parameters: pdate () function.

appendix:

1, the difference between dynamic parameter and the common parameters:

Common parameters are directly transmitted to the input parameter values ​​for calculation of the report, and the dynamic parameter is an expression, the expression will first analytical report when operation, then the expression as a result of the calculated parameter values ​​and then to the statements operations.

2, pdate function instructions:

Function Description:

The first day and the last day for the specified date falls week / month / quarter

grammar:

pdate(dateExp)

Parameter Description:

dateExp return value date date format or standard expression

return value:

DateTime

Options:

@w for the specified date falls on Sunday week

@we obtain the specified day of the week where Saturday

@m made months specified date where the first month

@me made at the end of the month where the specified date

@q quarter made the first day of the specified date falls

@qe get the end of the quarter where the specified date

The default is to obtain the specified day of the week where Sunday

@y Gets the specified date where the first day of year

Example:

例 1:pdate@w(datetime(“19800227”,“yyyyMMdd”)) 1980-02-24

例 2:pdate@we (datetime(“19800227”,“yyyyMMdd”)) 1980-03-01

Guess you like

Origin www.cnblogs.com/xiaohuihui-11/p/12054434.html