Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Is there a way in Qlik Sense to replace all the fields in all expressions in an app by a new field.
The reason is that the fieldname has changed.
Thanks,
Guy
Yes, you can replace the field by editing all the relevant expressions manually.
Perhaps it's possible to use the QS API. It's at least possible to export the app definition to a json file. You can then edit the json file to replace the field names. See https://github.com/countnazgul/QS-backup-and-restore-app for an example implementation of the json backup-restore mechanism
What you are suggesting is to re-create the field and give it the former (old) name ??
Correct ??
Hi,
I may be over simplifying , but can you not just alias the new field name to the old one it script?
I.e.
NewField AS OldFIeld
Mark
import win32clipboard
import time
import re
insensitive_count = re.compile(re.escape('count'), re.IGNORECASE)
insensitive_distinct = re.compile(re.escape('distinct'), re.IGNORECASE)
insensitive_field = re.compile(re.escape('FIELD_NAME'), re.IGNORECASE)
def transform_expression(e):
transform=insensitive_count.sub('SUM', e)
transform=insensitive_distinct.sub('', transform)
transform=insensitive_field.sub('NEW_FIELD_NAME', transform)
return transform
fn=transform_expression
transformed=''
continue_excution=True
while continue_excution:
try:
win32clipboard.OpenClipboard()
clipboard = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
if clipboard!=transformed:
transformed=fn(clipboard);
clipboard=transformed
print(transformed)
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(transformed)
win32clipboard.CloseClipboard()
time.sleep(0.05)
except KeyboardInterrupt:
continue_excution=False
except Exception as e:
print (e)
pass