Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
trishita
Contributor III

Syntax error in my code

Can anybody point out what is wrong in my code?

if(Sounding Correction Status='Correction Done',

     if(abs[Deviation after sounding]=abs[Difference Vs Log Survey],

        green(), //When value of the both fields match they display green

        if([Deviation after sounding] - [Difference Vs Log Survey]<>0,

             yellow(), //When value of the both fields differ they display yellow

             blue()

          ),

        red()  ////When Sounding Correction Status='Correction Not Done' they display red

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: Syntax error in my code

if([Sounding Correction Status]='Correction Done',
     if([Deviation after sounding]= [Summary.Difference Log vs Survey],
          green(), //When value of the both fields match they display green
     if([Deviation after sounding] - [Summary.Difference Log vs Survey]<>0,
          yellow(), //When value of the both fields differ they display yellow
          blue()
     )),
red()
)

View solution in original post

10 Replies
jmvilaplanap
Valued Contributor

Re: Syntax error in my code

Hi,

You need to close the first if statement

if(Sounding Correction Status='Correction Done',

     if(abs[Deviation after sounding]=abs[Difference Vs Log Survey],

        green(), //When value of the both fields match they display green

        if([Deviation after sounding] - [Difference Vs Log Survey]<>0,

             yellow(), //When value of the both fields differ they display yellow

             blue()

          ),

        red()  ////When Sounding Correction Status='Correction Not Done' they display red

)

Partner
Partner

Re: Syntax error in my code

Hi,

Maybe you have to close in braquets the field Sounding Correction Status. Like [Sounding Correction Status].

Saludos.

YoussefBelloum
Esteemed Contributor

Re: Syntax error in my code

Hi,

the field 'Sounding Correction Status' don't exist AND you can't create fields that contain spaces, without using" " or [ ]


like this:


[Sounding Correction Status]


or


"Sounding Correction Status"

alexc1994
New Contributor II

Re: Syntax error in my code

Perhaps try the below, closing the statement and correcting where bold


if([Sounding Correction Status]='Correction Done',


    if(abs[Deviation after sounding]=abs[Difference Vs Log Survey],


        green(), //When value of the both fields match they display green


        if([Deviation after sounding] - [Difference Vs Log Survey]<>0,


            yellow(), //When value of the both fields differ they display yellow


            blue()


          ),


        red()

       

        )

)

sasiparupudi1
Honored Contributor III

Re: Syntax error in my code

if([Sounding Correction Status]='Correction Done',

     if(abs[Deviation after sounding]=abs([Difference Vs Log Survey]),

        green(), //When value of the both fields match they display green

        if(([Deviation after sounding] - [Difference Vs Log Survey])<>0,

             yellow(), //When value of the both fields differ they display yellow

             blue()

          ),

        red()

trishita
Contributor III

Re: Syntax error in my code

Still having error:

if([Sounding Correction Status]='Correction Done',

if([Deviation after sounding]= [Summary.Difference Log vs Survey],

green(), //When value of the both fields match they display green

if([Deviation after sounding] - [Summary.Difference Log vs Survey]<>0,

yellow(), //When value of the both fields differ they display yellow

blue()
),
red()
)

mwoolf
Honored Contributor II

Re: Syntax error in my code

You have three ifs but only two closing parentheses.

trishita
Contributor III

Re: Syntax error in my code

don't know still showing some error ..bracket problems I guess

mwoolf
Honored Contributor II

Re: Syntax error in my code

if([Sounding Correction Status]='Correction Done',
     if([Deviation after sounding]= [Summary.Difference Log vs Survey],
          green(), //When value of the both fields match they display green
     if([Deviation after sounding] - [Summary.Difference Log vs Survey]<>0,
          yellow(), //When value of the both fields differ they display yellow
          blue()
     )),
red()
)

View solution in original post