Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jyothish8807
Master II
Master II

Creating Custom field in script

Hello friends,

     I have two tables and for both i have created a custom fields names as custom1 and custom2. Now i want to create a new custom field called Custom3 using both custom1 and custom2 which are in two different tables: (custom1*custom2 as custom3).

How can i create this field? Any help will be appreciated.

Table_a:

Name,

marks,

customfield as custom1

from c:........;

Table_b:

Name,

class,

customfield as custom2

Regards

KC

Best Regards,
KC
7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

At first You have to join the two tables to have only one, at this point reload this last table (remember noconcatenate)

and write the expression for your field

Hope it helps

mdmukramali
Specialist III
Specialist III

Dear,

if the comman key between this two tables Name.

then join these two tables and make them as one table. and create the new field.

else you can use Applymap also.

Thanks,

Mukram.

Anonymous
Not applicable

Try below,

Table1:

LOAD

Name,

marks,

customfield as custom1

from c:........;

Join

LOAD

Name,

class,

customfield as custom2

from d....

Table2:

LOAD

     *,

     custom1*custom2 as custom3

Resident Table1;

Drop Table Table1;

jyothish8807
Master II
Master II
Author

First table is coming from a single excel sheet , but table 2 is coming from 92 sheets. i am using

SUB DoDir (Root)

    FOR each File in filelist(Root& '\*.xlsx')   

table2:

Name,

Marks

FROM

[$(File)]

(ooxml, embedded labels, table is Sheet1);

NEXT File

FOR each Dir in dirlist (Root&'\*')

CALL DoDir(Dir)

NEXT Dir

END SUB

CALL DoDir('F:\Project Reporting;

Because of this i am not able join both tables.

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II
Author

First table is coming from a single excel sheet , but table 2 is coming from 92 sheets. i am using

SUB DoDir (Root)

    FOR each File in filelist(Root& '\*.xlsx')   

table2:

Name,

Marks

FROM

[$(File)]

(ooxml, embedded labels, table is Sheet1);

NEXT File

FOR each Dir in dirlist (Root&'\*')

CALL DoDir(Dir)

NEXT Dir

END SUB

CALL DoDir('F:\Project Reporting;

Because of this i am not able join both tables.

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II
Author

First table is coming from a single excel sheet , but table 2 is coming from 92 sheets. i am using

SUB DoDir (Root)

    FOR each File in filelist(Root& '\*.xlsx')   

table2:

Name,

Marks

FROM

[$(File)]

(ooxml, embedded labels, table is Sheet1);

NEXT File

FOR each Dir in dirlist (Root&'\*')

CALL DoDir(Dir)

NEXT Dir

END SUB

CALL DoDir('F:\Project Reporting;

Because of this i am not able join both tables.

Regards

KC

Best Regards,
KC
valeriy_ogienko
Contributor
Contributor

You can join these tables at any time after the initial load, not only during the initial load. After your code you may write:

join(table1)

load * resident table2;

drop table table2; //if you don't need it any more.

join(table1)

load Name, Marks, custom1*custom2 as custom3 resident table1; //you can join a table to itself.