Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

using if statements in Qlikview

Hi,

I try running the following script in SQL and it works fine.  I run it in QlikView and I don't receive any results or errors.  Any help appreciated.


if(at_fault='f',1,0) as AtFaultReturn#

12 Replies
robert_mika
Master III
Master III

Yes check  this case but

There a few things you can try:

-load only this field -check if you get any f's

-check if any other other statement does not interfere with this one

to example you have

where signed_on >= '2014-07-01';

are there any f's after this day?

- is it 'f' or maybe ' f' or 'f '

Could you post screenshot of your SQL table with 'f'?

You are missing a part of the if statement here:

if(????='Not BDL Lead',1,0)

Anonymous
Not applicable
Author

Thanks for your help Mika.

Even though SQL results showed me “f” it was actually 1. Grrrrrr

Laura Castagna

Business Systems and Process Analyst, NSW Business Chamber

140 Arthur Street North Sydney NSW 2060

Tel: 02 9458 7804 | Mob: 0429 486 934 | Web: www.nswbusinesschamber.com.au<http://www.nswbusinesschamber.com.au>

Twitter<http://www.twitter.com/nswbc> | Facebook<https://www.facebook.com/NSWBusinessChamber> | LinkedIn<http://www.linkedin.com/company/388425?trk=saber_s000001e_1000> | YouTube<http://www.youtube.com/nswbctv>

<http://www.nswbusinesschamber.com.au/>

Proud supporter of:

<http://acci.headsup.org.au/>

sasiparupudi1
Master III
Master III

try cast function to change it into a boolean value recognised by qlikview(1 or 0)

SQL SELECT

    FieldOfficer.first_name ||' '||

    FieldOfficer.surname as "Field Officer",

    signed_on as "Date Training Contract Signed",

    ss.name as Status,

    tc.id as id,

    received_on,

    tyims_employerid,

    AccountManager.first_name ||' '||

    AccountManager.surname as "Account Manager",

    tc.bdl_referred_by_id,

    last_kpi_action_date as "Status Date of change",

    employer_id as "Employer ID",

    appgivenname ||' '||

    appsurname as "Client Full Name",

    tc.created_at as "Created Date",

    BDLRefferedBy.id,

    tc.signup_status_id,

  tc.received_at ,

  tc.field_officer_id ,

  tc.account_manager_id ,

  tc.tier ,

  tc.employment_type_id ,

  tc.contract_type_id ,

  tc.finalised_on ,

  tc.approved_on ,

cast(  tcr.at_fault as int) as  at_fault


the above function works in sqlserver..if your db is something else, may be you need to adjust the syntax..


if this works then you can directly use at_fault as AtFaultReturn# in qlikview


hth

Sasi