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

[Feature request]Run changes on the entities (data tables) with a sql/linq/c# console #1717

Closed
enfJoao opened this issue Apr 2, 2019 · 5 comments

Comments

@enfJoao
Copy link

enfJoao commented Apr 2, 2019

I'm submitting a ...
[x] feature request

...about
[x] Content Types or data management

Current behavior
In 2sxc, from what I've learned, there are 4 ways to change data in a table/entity:

  • Manual click and edit in admin interface
  • REST / webapi in a view
  • App.Data in a controller
  • Export to xml, edit in excel, import again

What is the motivation / use case for changing the behavior?
Manual editing is slow, api involves creating views (and controllers sometimes) and excel is a piece of s*** for managing data.

What could be implemented
A direct command line interface like DNN SQL Console could be implemented so that two things could run:

  • Either a SQL support feature so that mass changes could be run with a single query, with proper API to use the app data, and not the DNN database (awesome)
  • Or a C# quick compile feature so that quick changes could be written like:
@foreach(var row in AsDynamic(App.Data["entity"]))
    {
        if(row.field == "oldvalue")
        {
               var editSet = new Dictionary<string, object>();
               editSet.Add("field", "newvalue");
               App.Data.Update(row.id, editSet);
        }
    }
}

This would probably error due to changing items while itinerating and calling the API multiple times in succession, but you get the idea.

This could also be used to quick change a field into another type (like copying a string field into a numeric new field, but using tryparse to check if it passes.

I know this is very far fetched, but think about it for version 11 or something.

@jeremy-farrance
Copy link

"excel is a piece of s***" - I just felt that needed some love. Love!!

@enfJoao
Copy link
Author

enfJoao commented Apr 2, 2019

Perhaps I understated it a bit...

@iJungleboy
Copy link
Contributor

Thanks for the input. Without knowing the details, I believe what you wrote could already work. And if you would put all new values into an array first, it could also be batch-updated. So I'm not sure if adding anything would be necessary?

@enfJoao
Copy link
Author

enfJoao commented Apr 3, 2019

SQL support would be a huge improvement in data management (and a quick c# compiling and running too) since they wouldn't need a module, a view, and probably a controller to achieve this. And sql would give a whole new level to data querying. Linq is fine for many things, but sql is sql.

@iJungleboy
Copy link
Contributor

I'll close this because I don't think anybody will address this anytime soon, or sponsor their time / money for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants