Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

PLS GIVE EXPLINATION ABOUT THIS SCRIPT?

data_temp:

LOAD * INLINE [

Customer

Abe

Bob

Charlie

David

];

product_temp:

LOAD * INLINE [

Product

Apple

Bottle

Coca Cola

Drink

];

LET vMinDate = '04/01/2014';

LEFT JOIN (product_temp) LOAD           -   WHY LEFT JOIN WRITTEN FIRST? ANY MEANING?

  Date,

  date(monthstart(Date),'MMM YYYY') as Month             -  WHAT THIS SYNTAX GIVE EXACTLY

;

LOAD

  date('$(vMinDate)' + recno() - 1) as Date

AUTOGENERATE 100;                                   -AUTO NUMBER MEANS?

LET vMinDate = null();

LEFT JOIN (data_temp) LOAD                         

  *,

  round(rand()*1000,.01) as Sales                              RAND  FUNCTION? IS WHAT?

RESIDENT product_temp;

data:

NOCONCATENATE LOAD * RESIDENT data_temp

WHERE mod(recno(),2)<>mod(round(rand()*1000),3)                     -THIS LINE

;

DROP TABLES data_temp,product_tem

PLS EXPLAIN I GREATFUL TO U

1 Reply
avinashelite

Hi Manoj,

As per my knowledge please find the explanation below:

     1.Left join is written to forcefully  link with  the product_temp table with the date and month, i don't find special                   meaning in the that probably if a date field in  product_temp table would have add a meaning.

    2.date(monthstart(Date),'MMM YYYY') as Month > this syntax will  Returns a value corresponding to a timestamp            with the first millisecond of the first date of the month containing date. The default output format will be the                    DateFormat set in the script.

     eg:monthstart ( '2001-10-19' ) returns '2001-10-01' with an underlying numeric value corresponding to '2001-10-01      00:00:00.000'

     3.AutoNumber> Returns a unique integer value for each distinct evaluated value of expression encountered during            the script execution. This function can be used e.g. for creating a compact memory representation of a complex            key.

** urs is not auto number  its autogenerate.

autogenerate is used if data should be automatically generated by QlikView.

size ::= number

Number is an integer indicating the number of records to be generated. The field list must not contain expressions which require data from a database. Only constants and parameter-free functions (e.g. rand(), recno()) are allowed in the expressions.

     4. Random Function>Returns a random number between 0 and 1.

     5.Mod>Mathematical modula function. Both parameters must have integer values. x2 must be greater than 0. The           result is the non-negative remainder of an integer division.

     Eg: mod( 7,2 ) returns 1

           mod( 7.5,2 ) returns NULL

           mod( 9,3 ) returns 0

           mod( -4,3 ) returns 2

     In your case they are posing a condition that the value  mod(recno(),2) should not be equal to the value        mod(round(rand()*1000),3) (<> means not equal)

Hope this helps you!!

Regards,

@vi