Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Module Code Argument Errors

I have inherited an application and am now trying to update it as the source system is migrating from an Oracle DB to a SQL DB.

There is some Module code that is used to control the sheet display

Basically dependent on the users filter selection either Tables/Charts A, B, C or D, E, F are displayed

The code seems pretty straightforward however the version of the application that is pointing at SQL has simply stopped working

I have been searching the community and the API Guide to try and find ways around this with no luck.

We are running QlikView 10

The code is as follows,I trimmed out the rest of the If statement for space

It runs as far as the code line that is in Bold and then gives an "Invalid procedure call or argument" error

I have been trying to verify the content of the 'values' variable using msgbox without any luck

It is almost as if the selection made on ReportContext is triggering the module but then getting lost somewhere

We have other much more complex applications that have been updated for the migration with only PL SQL related changes needed.

Even with setting a different value and using a For loop with conditions basedon Numeric or Text content i am not able to get the to the true content of 'values'

Sub OnSelectReportContext

  ActiveDocument.ClearAll

.... Chart Variable definitions

    Set reportContext = ActiveDocument.Fields("ReportContext")

    Set values = reportContext.GetSelectedValues

    If values.Item(i).Text = "Creation Date" Then

  'Creation Pivot/Line - Display/Maximize

... Chart display definitions - restore/top layer

In case it helps here is the script code where ReportContext is set.

DetailCreationDate:

Load

  DTL_ObjID, // key

  'Creation Date' As ReportContext // key

Resident Detail;

DetailCompletionDate:

Load

  DTL_ObjID, // key

  'Completion Date' As ReportContext // key

Resident Detail Where (DTL_LifeCycleState = 'IMPLEMENTATION' AND DTL_ObjState = 'COMPLETED') OR DTL_ObjState = 'CANCELLED';

-- This ignores teh DetailCompletionDate table label as the columns are the same in DetailCreationDate

I have verified that there are records in the table for both Completion Date and Creation Date

3 Replies
marcus_sommer

Try to check this field with a routine like this:

sub LogFunktion

   'This routine logs selection to a text file

   

   set fso = CreateObject("Scripting.FileSystemObject")

   set mypath = ActiveDocument.GetProperties

   directory = mypath.MyWorkingDirectory

  

   On Error Resume Next

   ' See if file already exists.

   Set filFile = fso.GetFile(directory & "log.txt")

   ' If not, then create it.

   If Err <> 0 Then

      Set filFile = fso.CreateTextFile(directory & "log.txt")

   End If

   Set txsStream = filFile.OpenAsTextStream(8) 'For Appending

 

   set doc = ActiveDocument

   set mySelections = doc.fields("Field").GetSelectedValues

     

   for i = 0 to mySelections.Count - 1

      txsStream.WriteLine Now & " " & mySelections.Item(i).text

   next

   txsStream.WriteBlankLines 1

   txsStream.Close

end sub

which is from APIGuide.qvw to write the field-values into a txt-file to find out if the field-values contain any kind of special chars which couldn't be processed through vbs or if the loop-counter isn't correct or to compare the syntax against each other (most often it are the small things ... ).

- Marcus

Not applicable
Author

Thanks Marcus,

I had been trying that kind of thing and mixing MSGBOX

I inserted the code in-line rather than in a function

I get the .txt file (one folder up than expected) but it is empty

Unless I'm confused over the "Field" element in the script example but I have tried both "Field" and the field I am interested "ReportContext"

I threw a couple of message boxes in to check the flow

Everything points to 'i' being null but I can't seem to verify that.

The "  ActiveDocument.ClearAll" statement at the top of my inherited code seems odd as the API Guide implies that this would clear the selections, but it does not seem to be.

Not applicable
Author

I never could get the log.txt file to have any content

After adding a bunch of msgbox statements to track the flow i was able to get it working simply by commenting out the

ActiveDocument.ClearAll statement


The Production version is working fine with the ActiveDocument.ClearAll statement not commented out