creecros / MetaMagik

Custom Fields for Kanboard - Plugin MetaMagik
MIT License
98 stars 16 forks source link

DB Field Usage #43

Closed githubetc closed 5 years ago

githubetc commented 5 years ago

Thanks for giving us a hint on how to use the DB field inside MetaMagik: tablename, keycolumn, valuecolumn

By making keycolumn the SAME as valuecolumn I can now list out all values in that column :) But it does not seem to work if the two column names are DIFFERENT :(

Can you please explain when we can use different column names ? May be we can select only certain values instead of all values in a column ?

Thanks for your help.

This references Closed Issue #29

Yeah, that's a tricky one, you can break things if you get it wrong.

groups,name,name

Would give you a drop down of all groups.

creecros commented 5 years ago

Give your example.

githubetc commented 5 years ago

Say for the "columns" table in kanboard, I want a drop down field showing "title" column values based on "project_id" column value equals a certain value.

So with the DB field format tablename, keycolumn, valuecolumn instead of using columns, title, title which will list ALL values in the "title" column.

Is it possible to use columns, project_id=5, title which will list only values if "title" belonging to "project_id=5"

I guess I am not sure about the difference between keycolumn and valuecolumn. When do we use different column names for keycolumn and valuecolumn ? Are they always the same ?

Thanks for your help.

creecros commented 5 years ago

Not gonna lie, I didnt incorporate this feature, not really used it much either. I'll take a look though and see if I can make it work as requested.

creecros commented 5 years ago

Although, now that I re read the question, I'm pretty sure it doesnt work that way. My thought would be key column should be what you see in the dropdown, valuecolumn should be the set of values that relate to the key. So, projectid=5 would not work, because it not the whole column, and the corresponding values column would have to match the key column in number. But, not really sure. So, I'll take a deep look at the feature, and report back its usage, and then we can go from there.

Example of what I think it should be: Table=users Keycolumn=name Valuecolumn=id

Dropdown is list of user names, but selecting a user stores the user's id in the value of the field.

This is how key/val works, and I'm pretty sure, maybe about 55%, this is how the feature works, but it's been so long since I've tinkered with it.

If I'm correct, which I'll check, what I can do is make that type of field, project specific, if you chose the project scope, versus global scope. So, that way, the titles will only correspond to the project its it's in. I say this with out looking at it, so hopefully it Is that simple. Might even look at protecting that field so no one can break things.

creecros commented 5 years ago

@githubetc So, after playing with it, it does not seem to work the way I would expect it to. Next chance I get, I'll improve, and possibly add a field to address your need. No timetable though.

githubetc commented 5 years ago

Thanks for investigating the issue and improving it.

Something general that supports ability to select only rows with a certain column value e.g. "project_id=5" as discussed above will be extremely useful.

Not sure what is the best way for me to contribute. Will a donation of say US$200 be proper or even enough for such an improvement ?

creecros commented 5 years ago

Donations are always welcome and very grateful for them. Whatever you feel comfortable donating. I'll take care of this tomorrow for you.

githubetc commented 5 years ago

I have donated US$200 via the donate button (it went through paypal). Thanks for your help with this.

creecros commented 5 years ago

@githubetc

https://github.com/creecros/MetaMagik/releases/tag/1.4.0

Give her a test drive. Let me know if you have any issues.

To produce your result, per your request, choose the new field type, Column from DB, based on equals Criteria

in the options, and this is an example, enter: tasks,project_id,5,title

this would provide a list of all task titles in the project with the id 5.

Also updated key/val to work as I would expect and added deselect options for all.

creecros commented 5 years ago

Also, i appreciate the donation, Thank you!