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.
Not applicable

Table alias

Hi Team,

I have an excel file containing unusual header names like F1, F2, F3 etc.

I want to change it in the form SubjectName_Externals, SubjectName_Internals and SubjectName_Practicals.

but the problem that I am facing is

Subject name is either of 2 word or more as shown below

Subject1 = 'Embedded System';

Subject2 = 'Imformation Security Management';

Kindly help me with a solution to resolve this issue.

I have also attached qvw file.

Regards

Priyanka

Tags (3)
1 Solution

Accepted Solutions
prieper
Honored Contributor II

Re: Table alias

You need to put square brackets into the script, not the variables:

Directory;

LOAD [Student Name] as Student_Name,

     [Paper-I] as [$(Subject1)_$(Ext)],

....

Peter

6 Replies
Employee
Employee

Re: Table alias

add square brackets in the variable values

change :

Let Subject1 = 'Embedded System';

Let Subject2 = 'Imformation Security Management';

Let Subject4 = 'Ethical hacking';

to:

Let Subject1 = '[Embedded System]';

Let Subject2 = '[Imformation Security Management]';

Let Subject4 = '[Ethical hacking]';

Not applicable

Re: Table alias

Hi Jonathan,

Thanks for you reply.

I tried to implement it and I got syntax error.

Regards,

Priyanka

prieper
Honored Contributor II

Re: Table alias

You need to put square brackets into the script, not the variables:

Directory;

LOAD [Student Name] as Student_Name,

     [Paper-I] as [$(Subject1)_$(Ext)],

....

Peter

Not applicable

Re: Table alias

Thanks Peter

Gabriel
Valued Contributor II

Re: Table alias

Hi,

Try this

Let Subject1 = chr(91) & 'Embedded System' & chr(93);
Let Subject2 = chr(91) & 'Imformation Security Management' & chr(93);
Let Subject3 = chr(91) & 'Virtualization' & chr(93);
Let Subject4 =chr(91) & 'Ethical hacking' & chr(93);


Employee
Employee

Re: Table alias

Hi - yes sorry.  because you are using 2 variables the square brackets need to come at the beginning and end of the full string.  Something like this:

Let Ext = 'External]';

Let Int = 'Internals]';

Let Prac = 'Practical]';

Let Subject1 = '[Embedded System';

Let Subject2 = '[Imformation Security Management';

Let Subject3 = '[Virtualization';

Let Subject4 = '[Ethical hacking';

then this: 

     [Paper-I] as

$(Subject1)_$(Ext),

will evaluate to

    

     [Paper-I] as[Embedded System_External];

Or you can try the valid alternative mentioned by PR too.

Community Browser