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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pkelly
Specialist
Specialist

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
m_woolf
Master II
Master II

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

View solution in original post

2 Replies
m_woolf
Master II
Master II

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
Specialist
Specialist
Author

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