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.
pkelly
Valued Contributor

Get Possible Values - Excluding?

Hi all...

Have the code below that loos through values in a field and transmits a PDF via e-mail.

"cus_Rpt09" field contains a blank value which does not require an e-mail to be sent.

Is there any way to exclude this from the Get Possible Values statement.

NB - Appreciate that the obvious route would be to exclude these from the data load but on this specific report I cannot do this as this is pass 2 out of 3 and excluding blanks on data load for this field would exclude non blanks from pass 1 and 3 which work from a different field.

Hope that makes sense!

Thanks in advance for any assistance...

Regards

Paul

'===========================================================================
sub SubmitReport2

ActiveDocument.ClearAll true

set v = ActiveDocument.Variables("varSubmission")
varSubmission = 2
v.SetContent varSubmission, true


Set val=ActiveDocument.Fields("cus_Rpt09").GetPossibleValues(20000)
For i = 0 to Val.count - 1

ActiveDocument.Fields("cus_Rpt09").Select val.item(i).Text

' set emailTo Variable

set ve = ActiveDocument.Variables("emailTo")
set vt = ActiveDocument.Fields("cus_Rpt09EmailAddress").GetPossibleValues

emailTo = vt.Item(0).text
ve.SetContent emailTo, true


' append Rpt09 to end of emailSubject variable

set v = ActiveDocument.Variables("emailSubject")
set vbase = ActiveDocument.Variables("emailSubjectBase")
set vname = ActiveDocument.Fields("cus_Rpt09Name").GetPossibleValues

emailsubject = vbase.GetContent.String + " - " + vname.Item(0).text

v.SetContent emailSubject, true

' Print Report

set doc = ActiveDocument.Variables("emailAttachment")

printReportPDF "RP01", doc.GetContent.String

' Email Report

SendMail

Next

ActiveDocument.ClearAll true

end sub

'===========================================================================

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: Get Possible Values - Excluding?

Set val=ActiveDocument.Fields("cus_Rpt09").GetPossibleValues(20000)

For i = 0 to Val.count - 1

    IF LEN( val.item(i).Text)>0 THEN

          ActiveDocument.Fields("cus_Rpt09").Select val.item(i).Text

' set emailTo Variable

          set ve = ActiveDocument.Variables("emailTo")

          set vt = ActiveDocument.Fields("cus_Rpt09EmailAddress").GetPossibleValues

          emailTo = vt.Item(0).text

          ve.SetContent emailTo, true

' append Rpt09 to end of emailSubject variable

          set v = ActiveDocument.Variables("emailSubject")

          set vbase = ActiveDocument.Variables("emailSubjectBase")

          set vname = ActiveDocument.Fields("cus_Rpt09Name").GetPossibleValues

          emailsubject = vbase.GetContent.String + " - " + vname.Item(0).text

          v.SetContent emailSubject, true

' Print Report

          set doc = ActiveDocument.Variables("emailAttachment")

          printReportPDF "RP01", doc.GetContent.String

' Email Report

          SendMail

     END IF

Next

2 Replies
mwoolf
Honored Contributor II

Re: Get Possible Values - Excluding?

Set val=ActiveDocument.Fields("cus_Rpt09").GetPossibleValues(20000)

For i = 0 to Val.count - 1

    IF LEN( val.item(i).Text)>0 THEN

          ActiveDocument.Fields("cus_Rpt09").Select val.item(i).Text

' set emailTo Variable

          set ve = ActiveDocument.Variables("emailTo")

          set vt = ActiveDocument.Fields("cus_Rpt09EmailAddress").GetPossibleValues

          emailTo = vt.Item(0).text

          ve.SetContent emailTo, true

' append Rpt09 to end of emailSubject variable

          set v = ActiveDocument.Variables("emailSubject")

          set vbase = ActiveDocument.Variables("emailSubjectBase")

          set vname = ActiveDocument.Fields("cus_Rpt09Name").GetPossibleValues

          emailsubject = vbase.GetContent.String + " - " + vname.Item(0).text

          v.SetContent emailSubject, true

' Print Report

          set doc = ActiveDocument.Variables("emailAttachment")

          printReportPDF "RP01", doc.GetContent.String

' Email Report

          SendMail

     END IF

Next

pkelly
Valued Contributor

Re: Get Possible Values - Excluding?

Thanks...will give it a go...

Community Browser