corectl icon indicating copy to clipboard operation
corectl copied to clipboard

Export/Import list of dim/measures/object

Open countnazgul opened this issue 6 years ago • 5 comments

Is it possible to export/import a predefined list of dim/measures/objects?

The idea is to have a list of IDs somewhere and extract their layout in json format (the output file will be used in another import operation).

I'm guessing that powershell/python/whatever script can be written that loops through the IDs list and use corectl to print the json and store the output. But was just wandering if corectl can do this for me ;)

countnazgul avatar Oct 05 '19 16:10 countnazgul

Short answer: no. But, you could use the --quiet flag. If you are using bash the following should work:

MEASURES=$(corectl measure ls -q | grep $1)
for m in $MEASURES; do
  corectl measure layout $m > "$m.json"
done

or if you prefer a oneliner:

MEASURES=$(corectl measure ls -q | grep "foo"); for m in $MEASURES; do corectl measure layout $m > "$m.json";done

Let me know if that helps @countnazgul !

glooms avatar Oct 07 '19 09:10 glooms

Yep it helps. I was planning to use something like this as a workaround :)

Need to free some time (somehow) and try and submit PR with this functionality ;)

countnazgul avatar Oct 07 '19 09:10 countnazgul

Nice! Could I just ask what the use case is?

You can specify a glob pattern when you import:

corectl object set obj*.json

So you can already specify exactly which "entities" to import using glob patterns.

The only support I might see missing is that you cannot export multiple entities at once. This would simplify the scripting a bit (excluding the need the for loop above) but I'm not sure it would satisfy your use case still.

glooms avatar Oct 07 '19 11:10 glooms

Yep the import seems ok(ish) for what i have in mind.

If you want we can jump on a quick call at some point and will explain you what i have in mind as a workflow :)

countnazgul avatar Oct 07 '19 14:10 countnazgul

Ye just ping us on branch slack (#qlik-core) :)

glooms avatar Oct 08 '19 08:10 glooms