Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Some scripting help needed - general script error occuring

Hi,

I have one diagram drawing on a database table that has no history.

=> I store the current date and a value in a qvd file every day, thus creating my own.

<=> Every other day, that app produces a "general script error". I cannot spot it.

Can anybody help me here, please?

The code is like this:

// First, I load the "qvd history" that is already there:

LOAD
    
Datum_num,
    
Datum_num as Datum_Hist,
//     DATE(Datum_Sp_AOS) as %Datum,
     Anzahl_Sachnrn
FROM
[..\01_QVD\Historische_qvd\Historie_Sperr1_64.qvd] (
qvd);

// Then I have to find out whether the preceding LOAD from a qvd has returned any records. (If not, I just want to construct a record with the current date and the nr. 0)

LET v_Nr_Rows_Sperr1 = NoOfRows('Sperr1_AOS'); 

// Next I have a RESIDENT LOAD from this preceding LOAD where I have to take into account this variable that tells me whether anything was found. I have two WHERE clauses because the app now runs all 3 hrs and I want the record for today only once and I want it after 11am - that is about the middle of a working_day, giving me a good approximation of the correct value (the value in the first run at about 3am would be more representative for yesterday)

CONCATENATE  (Hist_Sp1_64)
LOAD
    
$(v_today) as Datum_num,
     IF($(v_Nr_Rows_Sperr1)<>0, count(DISTINCT BIN_ITEM_DETAIL.ITEM_NUMBER), 0) as Anzahl_Sachnrn
RESIDENT Sperr1_AOS
WHERE NOT EXISTS(Datum_Hist, $(v_today))
and   Now() > '11:00:00'
;

It is at this point that the script usually produces a "General script error". I see just now in the log file it says "Misplaced FROM", easy enough - but all the commands are in blue which looks right to me.

Thanks a lot!

Best regards,

DataNibbler


P.S.: What's making this all quite confusing is that it seems to me that at some times, the script executes to the end - there is an error in the log, but it doesn't stop there - but the management_console says "Failed".

P.P.S.: One more strange thing - in the error message popup I see when I update manually, that CONCATENATE is visible twice - the same LOAD statement is printed there, immediately followed by a CONCATENATE and the same thing again - I don't have that in the script twice.

It looks like the semicolon was missing - but it is there.

1 Reply
datanibbler
Champion
Champion
Author

OK - solved.

After looking at it approx. 1000 times, I realized that, in the course of creating that qvs file on Friday, I had recreated two variables with different names.

So, since the scripting_editor does not show errors in variables once they are enclosed in this $() - which the book says should always be used? - I didn't notice that the variable didn't exist anymore - so the RESIDENT LOAD naturally failed.

Best regards,

DataNibbler