Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Read a text field and store it into a variable

Hi,

Is it possible to read a field which is text from a table and store the text value into a variable that can be used later?

Say the field is called “FiscalYear” and it contains this data “2016-2017”.   How would I do this?   Many of the examples I see

deal with numeric fields to be used with functions like SUM(), AGGR() and etc. 

Thanks!

16 Replies
avinashelite

How many values you have in your FiscalYear field

and try without the $ sign once

Anonymous
Not applicable
Author

Yes, without the dolloar sign worked.  Since it's text data, I surrounded the expression with tick marks like

= '$(vMaxFiscalYear )'


and it also worked !!.  Thanks for your help.


I will exploring Miguel's idea next.

Anonymous
Not applicable
Author

I only have one row in my table.

sunny_talwar

Sounds good

antoniotiman
Master III
Master III

Hi,

Try

Load Max(FiscalYear) as FiscalYear;
Load SubField(FiscalYear,'-') as FiscalYear Inline [
FiscalYear
2017-16 ]
;
LET vMaxFiscalYear = Peek
('FiscalYear');

Change Inline to Select .. From..

Regards,

Antonio

Anonymous
Not applicable
Author

When you do a PEEK('Max"), how does it know which table "Max" belongs to or does it scan ALL the tables

to look for this column??  It appears the latter is what QV is doing since I have multiple tables.

sunny_talwar

It looks for a Max in all tables and that is why this name needs to be unique and should not match with any field name you already have in your application