Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
upaliwije
Contributor II

Restrict Load

I have following script for creating a QVD file

VEH_TYPE:

//FIRST 1000

Load POLICY_NO,VEH_TYPE;

SELECT pol_policy_no POLICY_NO, pol_prs_type, pol_prs_type_desc  VEH_TYPE

  FROM cicl.mv_uw_vtype_info;

  store VEH_TYPE into e:\qlikview\Qvd\FACT_table\VEH_TYPE.qvd;

  Trace

  drop table VEH_TYPE;

I want to restrict the load of this script by applying a condition say if flag=Y

How can I do it please

1 Solution

Accepted Solutions

Re: Restrict Load

Dear Upali,

For your script check the below load script

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';


Let flag = 'Y';

If flag = 'Y' then

VEH_TYPE:

//FIRST 1000

Load POLICY_NO,VEH_TYPE;

SELECT pol_policy_no POLICY_NO, pol_prs_type, pol_prs_type_desc  VEH_TYPE

FROM cicl.mv_uw_vtype_info;

Store VEH_TYPE into e:\qlikview\Qvd\FACT_table\VEH_TYPE.qvd;


Trace 'Script Run Successful'

Drop table VEH_TYPE;

END IF

Regards,

Anand

9 Replies

Re: Restrict Load

Hi,

Try like this

VEH_TYPE:

//FIRST 1000

Load POLICY_NO,VEH_TYPE;

SELECT pol_policy_no POLICY_NO, pol_prs_type, pol_prs_type_desc  VEH_TYPE

  FROM cicl.mv_uw_vtype_info

where flag='Y';

Regards

ASHFAQ

upaliwije
Contributor II

Re: Restrict Load

This is  not my requirement. There is no filed Called Flag in my source table. I want to create a variable called flag

Like

set Flag=Y

then use that variable to restrict laod

Re: Restrict Load

Ok,

For what condition you need to set Flag='Y'

Explain properly.

Regards

ASHFAQ

upaliwije
Contributor II

Re: Restrict Load

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

set flag=Y

If flag=Y

VEH_TYPE:

//FIRST 1000

Load POLICY_NO,VEH_TYPE;

SELECT pol_policy_no POLICY_NO, pol_prs_type, pol_prs_type_desc  VEH_TYPE

  FROM cicl.mv_uw_vtype_info;

  store VEH_TYPE into e:\qlikview\Qvd\FACT_table\VEH_TYPE.qvd;

  Trace

  drop table VEH_TYPE

  ;

Can I add a  condition like above given in Bold

Re: Restrict Load

Hi,

Can you explain what are yo trying to achieve here?

Regards

ASHFAQ

upaliwije
Contributor II

Re: Restrict Load

Hi

What I am trying to achieve is to load this script as and when I want to do this. There are some more loading in the same file but I want this loading to be done once a month

Re: Re: Restrict Load

Hi,

You can try something like this

SET flag='Y';

If (flag)='Y' then

load * Inline

[

Month

Jan

Feb

Mar

];

ENDIF

Trace 'Ashfaq'

Take a new file and try by changing value of flag to Y and N as required.

Regards

ASHFAQ

Re: Restrict Load

Dear Upali,

For your script check the below load script

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';


Let flag = 'Y';

If flag = 'Y' then

VEH_TYPE:

//FIRST 1000

Load POLICY_NO,VEH_TYPE;

SELECT pol_policy_no POLICY_NO, pol_prs_type, pol_prs_type_desc  VEH_TYPE

FROM cicl.mv_uw_vtype_info;

Store VEH_TYPE into e:\qlikview\Qvd\FACT_table\VEH_TYPE.qvd;


Trace 'Script Run Successful'

Drop table VEH_TYPE;

END IF

Regards,

Anand

upaliwije
Contributor II

Re: Restrict Load

Thanks both of you

Community Browser