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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview will not read field and create a variable

Hi

I have this weird problem. I got an excel sheet that got 3 columns

TickerExchangeTickerAndExchange
TEL.OLTEL.OL
YAR.OLYAR.OL
NHY.OLNHY.OL
NOFI.OLNOFI.OL

I have created three variables so that I can use these values in creating a URL string:

for i=1 to NoOfRows('TickerList')

  LET vNameOfStock = FieldValue('Ticker', $(i));

  LET vStockAndExchange = FieldValue('StockAndExchange', $(i));

  LET vNameOfExchange = FieldValue('Exchange', $(i));

  LET vFullPathStock = '..\StockMarketAnalysis\QVD\' & '$(vNameOfStock)' & '.qvd';

  LET vFileExsist = if(FileSize('$(vFullPathStock)')>0,-1,0);

  if $(vFileExsist) then

       Call Incremental(vNameOfStock, vNameOfExchange);

  Else

       Call NonIncremental(vNameOfStock, vNameOfExchange);

  End if;

Next i;

Somehow the variable vNameOfExchange will only catch the first rows value, and the rest is NULL. I have tried to remove the dot, I have changed the order of the variables, I have tried to empty the variables using LET vNameOfExchange = NULL();

Anyone who knows why this is happening?

Best regards

Espen

1 Solution

Accepted Solutions
sunny_talwar

FieldValue function only look at the distinct combination of values within a field. Since all 4 rows contain the same value .OL. it picks it only the first time. Do you have more Exchange or is it always .OL?

View solution in original post

7 Replies
sunny_talwar

FieldValue function only look at the distinct combination of values within a field. Since all 4 rows contain the same value .OL. it picks it only the first time. Do you have more Exchange or is it always .OL?

Not applicable
Author

Aha, i see. Well, i could have different values, at the moment i dont, but in future yes. Should I rather use some sort of PEEK()?

Best regards
Espen

sunny_talwar

Yes, I think Peek() would be a better way to do this.

Not applicable
Author

Ok, thanks a lot - I would never figured that out on my own.

BR

Espen

sunny_talwar

Or may be try this approach:

TickerList:

LOAD *,

  Exchange&'|'&RecNo() as New_Exchange;

LOAD Ticker,

    Exchange,

    TickerAndExchange as StockAndExchange

FROM

[https://community.qlik.com/thread/229531]

(html, codepage is 1252, embedded labels, table is @1);

for i=1 to NoOfRows('TickerList')

  LET vNameOfStock = FieldValue('Ticker', $(i));

  LET vStockAndExchange = FieldValue('StockAndExchange', $(i));

  LET vNameOfExchange = SubField(FieldValue('New_Exchange', $(i)), '|', 1);

sunny_talwar

Attaching the incomplete sample, but it seems that all Exchanges get picked

Capture.PNG

Not applicable
Author

Thanks.

Yes I was thining about some workaround, but I wanted to figure out what was wrong, and I tested with PEEK() now, it works perfect.