Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a way to have a text object display information based on what the current selections are? For example, say the user has selected Bldg 1 and Bldg 2. Can the text object then display the value from the Address field for Bldg 1 in text object 1 and the address field for Bldg 2 in Text Object 2? Then if the selections change, the values in the text objects change along with them. Thanks in advance for any assistance.
Actually you might want to use:
=only({<Building={"$(=subfield(concat(Building, '|'), '|', 1))"}>}Address)
=only({<Building={"$(=subfield(concat(Building, '|'), '|', 2))"}>}Address)
The way concat sorts might cause a problem, it will sort on address, and not necessarily the order of buildings.
Hope this helps!
Hi Jensen,
For a text object, you can use a function =GetCurrentSelections(FieldName). When selections are made to that specific field, the text will be displayed in the text object.
Thanks,
Sai
from qlikview online help
getfieldselections ( FieldName [, ValueSep [, MaxValues]])
Returns a string with the current selections in a field.
ValueSep is the separator to be put between field values. The default is ', '.
Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6.
Examples
getfieldselections ( Year )
getfieldselections ( Year, '; ' )
getfieldselections ( Year, '; ' , 10 )
getcurrentselections ([RecordSep [, TagSep [,ValueSep [, MaxValues]]]])
Returns a string with the current selections in the document.
RecordSep is the separator to be put between field records. The default is <CR><LF>.
TagSep is the separator to be put between the field name tag and the field values. The default is ': '.
ValueSep is the separator to be put between field values. The default is ', '.
Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6.
Examples
getcurrentselections ( )
getcurrentselections ( chr(13)&chr(10) , ' = ' )
getcurrentselections ( chr(13)&chr(10) , ' : ' , ' ; ' )
getcurrentselections ( chr(13)&chr(10) , ' : ' , ' ; ' , 10 )
Unfortunately, that doesn't seem to work in this case (returns a "-"). I think it is because the only field selected is the building name not the address. What I'm looking for is if one field is selected and has two values selected, the corresponding text object displays it's field value.
Current selections: Building Name: Bldg One, Bldg Two
Text object 1: Address for Bldg One
Text Object 2: Address for Bldg Two
Unfortunately it doesn't seem to work, returns a "-". Could it be because the only selections are in the Building name field but what I want to display is in the address field which wasn't explicitely selected?
You can try something like:
=subfield(concat(distinct Address, '|'), '|', 1)
This will concatenate the Address according to your selections of Building (so only the addresses of building 1 and 2 should be there), then subfield will return the first address in the list. Also,
=subfield(concat(distinct Address, '|'), '|', 2)
should get the second address.
Hope this helps!
Thanks I'm going to try that but one question. What is the 'I' in the expression?
Actually you might want to use:
=only({<Building={"$(=subfield(concat(Building, '|'), '|', 1))"}>}Address)
=only({<Building={"$(=subfield(concat(Building, '|'), '|', 2))"}>}Address)
The way concat sorts might cause a problem, it will sort on address, and not necessarily the order of buildings.
Hope this helps!
Once again you've come through with an answer for me! Works great! Thanks!