Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON View? #69

Closed
liveandletbri opened this issue Jun 22, 2017 · 10 comments
Closed

JSON View? #69

liveandletbri opened this issue Jun 22, 2017 · 10 comments
Labels
enhancement Feature requests / improvements to existing features (not bugs)
Milestone

Comments

@liveandletbri
Copy link

liveandletbri commented Jun 22, 2017

It would be nice if there was a way to scroll through and edit the JSON for the model and/or a particular object.

To my knowledge, if I want to edit JSON directly, I would have to:

  1. Export the JSON
    a. Either by dragging an object into a text editor and saving it as a .json file
    b. Or by using "Export translations...", which is always grayed out no matter what I try
  2. Edit the JSON in a separate file
  3. Use "Import translations..."

Is that correct?

If so, I think it would be useful to have another view next to "DAX Editor" and "Advanced Scripting" that was for editing JSON. Let me know your thoughts!

@otykier
Copy link
Collaborator

otykier commented Jun 23, 2017

Yes - other than the options mentioned, there is no way currently to directly edit the JSON metadata in Tabular Editor.

I really like the idea of having a JSON tab next to the two current editor tabs. However, the main goal of Tabular Editor is to provide UI so that you don't need to edit the JSON manually. May I ask what specific need you have in this case?

@liveandletbri
Copy link
Author

Well, originally I was looking for it to get around the bug with the Query property of a partition, but beyond that I would use it mostly for copying/pasting measures and tables within the model and between models.

For example, I may end up making several measures that have almost identical DAX save for a tweak or two. I can copy/paste their names, DAX, display folder, and formatting strings all at once, then go back to each copy and make the tweak as necessary. Alternatively, since I work with several cubes that are all structured quite similarly, I find myself often copying and pasting measures and even tables between cubes.

Basically it gives me the complete control that C# offers without having to learn C# 😄 Is there a way to do any of these things currently? I support the idea that the UI should replace the need to modify JSON.

@otykier
Copy link
Collaborator

otykier commented Jun 28, 2017

It seems that most of the functionality you need is already readily accessible through the UI - my apologies that features are not better documented than they are :-)

  • Copying measures/calculated columns within a model: Simply (multi)select the objects in the tree, right-click and choose "Duplicate". Then, optionally use the "Batch Rename" option to rename the duplicated objects (which will be suffixed with the word "Copy").
  • Copying measures/calculated columns between models: Try to open two instances of Tabular Editor, and load a model into each of them. Now, simply drag and drop the measures or calculated columns between the two instances, to create copies in the destination model. It's a little buggy at times, but in general, it works! I'm putting the option of copying entire tables between models on the to-do list.

After some more thought, I realise that having a read/write JSON editor tab might not be feasible, as it will be difficult to track and react to changes made to the JSON. Instead, what I could do is provide an "Import object from JSON" option, that lets you import table objects or entire tables, by pasting in a piece of JSON representing the object. This would work similar to how the "Import translations" feature, but allow you to import more types of objects. Export to JSON, as you already know, is simply a matter of dragging the object into a text editor.

Kindly let me know your thoughts on that.

@liveandletbri
Copy link
Author

That sounds like an excellent idea. Thanks for the info! I'll try these features out next time.

@otykier otykier added the enhancement Feature requests / improvements to existing features (not bugs) label Jun 30, 2017
@otykier
Copy link
Collaborator

otykier commented Oct 6, 2017

Release 2.6 will feature familiar cut/copy/paste operations directly in the Explorer Tree. Objects will be stored in the clipboard as JSON. This means you can select a number of objects in Tabular Editor, hit CTRL+X and paste into any text editor, manipulate the JSON however you want, then copy and hit CTRL+V back in Tabular Editor to insert the manipulated objects :-)

@otykier otykier added this to the 2.6 milestone Oct 6, 2017
@otykier otykier closed this as completed Oct 6, 2017
@logik360
Copy link

hi ,
. I can understand that TEditor is mainly a UI tool but having the ability to import code is essential.
Imaging a scenarion (i have it offen) where I can copy paste measures (with small changes ) and put them in folders.
I can create something like that even in excel and then import the Json in TEditor.
I used this technik many times in SSAS in Visual Studio
best
A.B

@otykier
Copy link
Collaborator

otykier commented Mar 26, 2021

You can sort of already do this today. Try to copy a few measures from Tabular Editor into the clipboard. Then, paste the code into a text editor. As you can see, Tabular Editor simply uses the JSON definition of the measures, when copying them to the clipboard. So you can do the reverse as well: Generate the JSON in Excel, copy the JSON into the clipboard and then pasting into Tabular Editor.

@logik360
Copy link

logik360 commented Mar 27, 2021 via email

@otykier
Copy link
Collaborator

otykier commented Mar 28, 2021

@logik360 the problem with allowing import of arbitrary TOM/JSON is that it doesn't always play well with the metadata that is already loaded into memory. But the good news is that Tabular Editor provides many other options for working with the metadata programatically.

For example, a common scenario is to use scripting to import measures in batches. Here's an article that illustrates one way to do this: https://docs.tabulareditor.com/Useful-script-snippets.html#generating-measures-from-a-file

@logik360
Copy link

logik360 commented Mar 28, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests / improvements to existing features (not bugs)
Projects
None yet
Development

No branches or pull requests

3 participants