Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
max_potass
Creator
Creator

Script Line Error. Can't find my mistake

So I am currently trying to get following code working. When I execute it, I get a Script line Error. The code mentioned in the error starts at line 11. It probably is just a stupid mistage or misconseption as I am very new to this and have like no prgramming experience...

It would be nice, if someone can help me.

Let URL_Base='something';

Let Timeout='something';

Let URL_Open_1='something';

Let URL_Open_2='something';

Let URL_Intern_1='something';

Let URL_Intern_2='something';

Let URL_Extern_1='something';

Let URL_Extern_2='something';

For counter_1=0 to 2

  Let URL_1=$(URL_Base)&IF($(counter_1)=0,$(URL_Open_1),IF($(counter_1)=1,$(URL_Intern_1),$(URL_Extern_1)));

  Let URL_2=$(Timeout)&IF($(counter_1)=0,$(URL_Open_2),IF($(counter_2)=1,$(URL_Intern_2),$(URL_Extern_2)));

  For counter=0 to 14

  Let URL=$(URL_1)&($(counter)*1000)&$(URL_2);

  CUSTOM CONNECT TO $(URL);

  RestConnectorMasterTable:

  SQL SELECT

  "__KEY_root",

  (SELECT

            "key",

              "__KEY_issues",

            "__FK_issues",

              (SELECT

                    "created",

                    "__KEY_fields",

                    "__FK_fields",

                    (SELECT

                    "@Value",

                        "__FK_customfield_10306"

                    FROM "customfield_10306" FK "__FK_customfield_10306" ArrayValueAlias "@Value"),

                    (SELECT

                        "@Value" AS "@Value_u0",

                        "__FK_customfield_10305"

                    FROM "customfield_10305" FK "__FK_customfield_10305" ArrayValueAlias "@Value_u0")

              FROM "fields" PK "__KEY_fields" FK "__FK_fields")

        FROM "issues" PK "__KEY_issues" FK "__FK_issues")

  FROM JSON (wrap on) "root" PK "__KEY_root";

  [customfield_10306]:

  LOAD   [@Value],

        [__FK_customfield_10306]&'.1' AS [__KEY_fields]

  RESIDENT RestConnectorMasterTable

  WHERE NOT IsNull([__FK_customfield_10306]);

  [customfield_10305]:

  LOAD   [@Value_u0],

        [__FK_customfield_10305]&'.1' AS [__KEY_fields]

  RESIDENT RestConnectorMasterTable

  WHERE NOT IsNull([__FK_customfield_10305]);

  [fields]:

  LOAD [created],

        [__KEY_fields]&'.1' as [__KEY_fields],

        [__FK_fields]&'.1' AS [__KEY_issues]

  RESIDENT RestConnectorMasterTable;

  [issues]:

  LOAD   [key],

        [__KEY_issues]&'.1' as [__KEY_issues]

  RESIDENT RestConnectorMasterTable;

  Drop Tables [RestConnectorMasterTable];

  Let counter=$(counter)+1;

  next

Set counter=0;

Let SLA=If($(counter_1)=0,'open',If($(counter_1)=1,'intern','extern'));

STORE [customfield_10306] INTO customfield_10306_$(SLA).qvd (qvd);

STORE [customfield_10305] INTO customfield_10305_$(SLA).qvd (qvd);

STORE [fields] INTO fields_$(SLA).qvd (qvd);

STORE [issues] INTO issues_$(SLA).qva

15 Replies
marcus_sommer

I would go for an excluding-strategy. At first commenting the second/third script-tab (or per exit script;), then commenting the loading within the loop, then reducing the number of loop-iterations and some similar measures - I think you will be quite soon hit the error-reason.

- Marcus

settu_periasamy
Master III
Master III

Hi,

Can you try to remove the double quote for the variable URL_Base and check it?

Capture.JPG

Try,

Let URL_Base='Provider=QvRestConnector.exe;url=https://ticket.xxx.services/rest/api/2/search?jql%2';

vishsaggi
Champion III
Champion III

As Marcus Suggested debug the script as chunks and see where you getting this error?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Settu is right. The error you get when executing your script is because of the unterminated double quote that causes everything after that line to be included in the LET statement.

Note that a statement like

Let URL_Base = ' "Provider=.....search?jq1%2';

will assign the string without the single quotes to variable URL_Base.

$-sign expansion in the first LET inside the FOR loop will then produce something highly illegal in scripting terms, like:

Let URL_1="Provider=...search?jq1%2&IF(0=0, (project%%20%2%%20%3BU...&maxResults%21000&startAt%2));

which isn't exactly regular QlikView script code. You could fix the quote problem by adding another double quote in the last expanded variable, but your embedded IFs certainly won't be executed as expected.

If you don't have any programming experience, and you want to do complex things in QlikView script, start with the easier stufff until you grow accustomed to the intricacies of string quoting, embedded IFs and $-sign expansion.

max_potass
Creator
Creator
Author

I had no time to fix this code, so I just did not loop the different URLs and put it in different tabs... But thanks for the help.

The Debugging did not help, as I see no error in my code. This apparently causes the error:

Let URL_1=$(URL_Base)&IF($(counter_1)=0,$(URL_Open_1),IF($(counter_1)=1,$(URL_Intern_1),$(URL_Extern_1)));

But even if the variables included are wrong, it should not give an script line error. I mean I only connect strings. It should give me an failed to connect later, if the URL is wrong.

Anyway, I have a solution that works, but it's just not as nice as this would have been.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Good to hear that you managed to eliminate the problem.

However, with respect to your statement "But even if the variables included are wrong, it should not give an script line error", I think you are mistaken. Allow me to explain myself, as it may help you in handling similar situations in the future.


Your Let statement uses $-sign substitution to create the eventual value to assign to variable URL_1. However, the $-sign substitution will replace all $(variable) constructs after the equal sign with the contents of the respective variables before evaluating the statement itself.

If - as you say - one or more of these variables contain invalid content, then the $-sign substitution will produce a syntactically incorrect right hand-part of the Let statement. The script engine then tries to make sense of the wrongly formatted statement and is unable to.

That's why you get a generic message "Script Line Error" which is used to denote (amongst others) all statement syntax errors (like unbalanced quotes, too many comma's, missing semicolon terminators and whatever can be added or omitted from a statement).


Keep in mind that whenever you get a "Script Line Error", usually something very small/simple is missing in your code. And it's more than likely that you will get this message again some time in the future.


Good luck.