Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how can we get table name using field value.

how can we get table name using  field value.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Clear enough now.
Join both table into one, and create additional fields of ServiceName.  Later, use them as flags to find where they came from.  Maybe like this:

Table:
LOAD DISTINCT
ServiceName,
ServiceName as SN1,
InstallationDate,
ExpiryDate
FROM System1;

OUTER JOIN (Table) LOAD DISTINCT
ServiceName,
ServiceName as SN2,
StartDate,
EndDate
FROM System2;

Result:
LOAD DISTINCT
ServiceName,
InstallationDate,
ExpiryDate,
StartDate,
EndDate
if(SN1=SN2, 'both', if(ServiceName=SN1, 'System1', 'System2')) as status
RESIDENT Table;

DROP TABLE Table;

Regards,

Michael

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Could you please clarify what you mean, preferably with an example?

If assume you're asking about the Window Title (caption) of the table - you can use something like

=Field

But it will work only if one value of the field is selected.

Not applicable
Author

He refers to the Name of a table in the script isnt it?

Not applicable
Author

System1

ServiceNameInstallation DateExpiry Date
Abc1/1/20111/1/2012
xyz2/2/20112/2/2013
pQR1/4/201112/5/2011
MNC2/2/20121/4/2013
bcD3/3/2014

1/1/2015

System 2

ServiceNameStartDateEndDate
aBc2/2/20115/5/2011
Mno3/3/200012/5/2000
SPr1/2/20091/2/2010
PqR5/5/20116/6/2011
Bcd2/4/201412/12/2015
mNC3/3/20125/5/2012

I want to merge these two tables based on service Name field without using upper function.

Then we have to add new field named Status it should filed with table name based on service name

Ex:

Service Nameinstallationsateexpiry datestart datestopdatestatus
bcD3/3/20141/1/20152/4/201412/12/2015both
xyz2/2/20112/2/2013nullnullSystem1
Not applicable
Author

Load the tables in this way

System1:

Load

ServiceName,

InstallationDate,

ExpiryDate,

'System1' as Status

and

System2:

ServiceName,

StartDate,

EndDate,

'System2' as Status

and after that in the Status make it a derived field with expression.

=if(count(Status)>1, 'both', Status)

Anonymous
Not applicable
Author

Clear enough now.
Join both table into one, and create additional fields of ServiceName.  Later, use them as flags to find where they came from.  Maybe like this:

Table:
LOAD DISTINCT
ServiceName,
ServiceName as SN1,
InstallationDate,
ExpiryDate
FROM System1;

OUTER JOIN (Table) LOAD DISTINCT
ServiceName,
ServiceName as SN2,
StartDate,
EndDate
FROM System2;

Result:
LOAD DISTINCT
ServiceName,
InstallationDate,
ExpiryDate,
StartDate,
EndDate
if(SN1=SN2, 'both', if(ServiceName=SN1, 'System1', 'System2')) as status
RESIDENT Table;

DROP TABLE Table;

Regards,

Michael

MK_QSL
MVP
MVP

bcD & Bcd is different.... without using UPPER or LOWER function, how can we concatenate... Field name should be matching...

Anonymous
Not applicable
Author

Correct, if not use upper or lower, they will be regarded as two separate values.  Which they are.

MK_QSL
MVP
MVP

but the result table shown in the question tell different story !!

How can we get...

Service Nameinstallationsateexpiry datestart datestopdatestatus
bcD3/3/20141/1/20152/4/201412/12/2015both
Anonymous
Not applicable
Author

There are two questions here.

1. Can we Show service name without using upper/lower?  The answer is yes.  We can have an additional field just for presentation, without upper, and use upper for all other copies of the field.

2. Decide what to show, bcD or BCd.  I don't know.  I only can tell that it can't be both.

😞