Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hamid_Reza_Rashidi
Contributor
Contributor

Expressions

Hi, Everybody, would you please let me know , how to set an expression to use it for different cells.

for Example,

i am going to take the 2 first digits of a column and multiply it to 10.

My Table is 

Row, CA,CB,CC

1,1480,2020,2223

2, 1458,2021,2224

....

...

i need a variable like followings:

Let vTwodig=Left (x,2)*10

x= any column CA,CB,CC and ....

I want to define a new column (CD) the expression which i like to use some thing like following:

vTwodig CC

and next column CE:

Vtwodig CD

Best Wishes

5 Replies
Yousef_Amarneh
Partner - Creator III
Partner - Creator III

the example is not clear, can you please provide a sample of data and the expected behavior 

Yousef Amarneh
Hamid_Reza_Rashidi
Contributor
Contributor
Author

Dear Yousef, Thanks for considering my case. This simple sample is for selecting two left digits of all rows of a column by 10. as i want to apply this formula to many columns, can i define a variable to have all things fixed expect the column hope i make i clear. if it is not clear, please let me know to provide more information.
Hamid_Reza_Rashidi
Contributor
Contributor
Author

Hi, thanks for your reply

please do check the following sample.

 

Let  x=left(y,2)

"y" is one of my column in a table.

if i writ the formula the same as followings:

Let  x=left(,2)

can i use varible x to calculate the 2 left digits of column z. (=Left(z,2)) 

= x (Z),

the the answer be the same as = left(Z,2),

Best regards

Brett_Bleess
Former Employee
Former Employee

Hamid, maybe a dumb question on my part, but have you considered doing things in the load script instead of via expression and creating that value as its own field in the data load?  I too am having trouble grasping what it is you are really trying to accomplish with things, and I know you have now tried twice to clarify things, but it is still not really making much sense.

I think if you shift this to the load script it may be much easier, as you can take that field during the load and load it twice, once as it is, but then you can do the transformation on the next line doing your left function on it, and multiplying if need be etc.  This way everything is tied into the rest of the data model.  Sorry I do not have anything better, but if you can further clarify the use case etc. and again, you may need to supply a screenshot or something of what you have as far as data and what you are trying to obtain, that will likely help folks visualize things a lot better.  Apologies I do not have anything better for you.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Brett_Bleess
Former Employee
Former Employee

Also see apparent duplicate post: https://community.qlik.com/t5/New-to-QlikView/expression/m-p/1650462#M383865

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.