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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
knightwriter
Creator III
Creator III

GetCurrentField query

Hi All,

I am using the GetCurrentField(goupname) in the general tab under chart title.

This works fine apart from the group name that it is pulling is made up of an expression (ie =Left([Car sales.first name],1) & .....).

Is there a way I change this expression name to 'Sales Person'? Changing the label name under group setting only works for the cyclic logo and not the chart title name.

Suggestions welcome. Thanks.

1 Solution

Accepted Solutions
sunny_talwar

My bad:

If(GetCurrentField ([activity group]) = '=left ([Sales_Sales.First Name],1) & ' & Chr(39) &'.'& Chr(39) & ' & [Car_Sales.Last Name]', 'Sales Person', GetCurrentField([activity group]))

View solution in original post

14 Replies
sunny_talwar

Try this:

If(GetCurrentField(GroupName) = '=Left([Car sales.first name],1) & .....)', Car Sales, GetCurrentField(GroupName))


If(GetCurrentField(GroupName) = '=Left([Car sales.first name],1) & .....)', 'Sales Person', GetCurrentField(GroupName))

Make sure you have the exact expression, including the spaces and commas, within the two single quotes.

HTH

Best,

Sunny

avinashelite

can you please share the sample data   or QVW ..it will give us a better idea what exactly your looking for??

OR you can explain with an example

knightwriter
Creator III
Creator III
Author

Hey Sunny,

Thanks for the note.

I have put this into the title in chart box and get error in expression.

=IfGetCurrentField ([activity group]) = '=left ([Sales_Sales.First Name],1) & '. ' & [Car_Sales.Last Name]', Car Sales, GetCurrentField([activity group])

Does Car Sales need to be in single quotes? As the chart title should show 'Sales Person'.

Continuing on from this, do I repeat this for the second field in my group?

sunny_talwar

Yes it does. I did make the change in my above comment.

If(GetCurrentField ([activity group]) = '=left ([Sales_Sales.First Name],1) & '. ' & [Car_Sales.Last Name]', 'Sales Person', GetCurrentField([activity group]))

sunny_talwar

And yes repeat this for all your calculated fields.

knightwriter
Creator III
Creator III
Author

Hi Avinash.

I have a cyclic group with two fields. The two fields within this group both have expressions in them so when I use the getcurrentfields(groupname) in the Title Chart on the general tab, its pulls the expression from the 'used field'.

This expression then sits above the chart and is not very user friendly.

I want to be able to change the name under the 'used field' to represent something easy to read.

jonathandienst
Partner - Champion III
Partner - Champion III

You can give the expression a label in the Document Properties | Groups tab. Select the Group, Click Edit..., select the calculated field (in Used Fields) and enter a label in the Label box.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
knightwriter
Creator III
Creator III
Author

Hi Sunny,

Thanks Ive 95% got the answer here.

I still get an error as I've already used single quotes in my group expression to be used within the IF function. See highlighted in red below and so when I use the single quotes I still get this error. How do I get around this?

If(GetCurrentField ([activity group]) = '=left ([Sales_Sales.First Name],1) & '. ' & [Car_Sales.Last Name]', 'Sales Person', GetCurrentField([activity group]))


Your formula works perfectly for the other field in my group (and its has no single quotes in the original expression!)

sunny_talwar

Try this:

If(GetCurrentField ([activity group]) = '=left ([Sales_Sales.First Name],1) & ' & Chr(39) &.& Chr(39) & ' & [Car_Sales.Last Name]', 'Sales Person', GetCurrentField([activity group]))


Chr(39) = Single Quote