My goal is to create a matrix like shown on this picture from database values:
The object diagram is shown below. I'm using LINQ and Entity Framework Core.
So I want to get all Users and all Customers that are in database and if there is an entry in UserOrder table for user and order, display the user order value as value in matrix.
I'm then trying to use these values in a kendo grid.
Hope you understand what I was trying to explain, please ask if there are any unclear details. (I am unfortunately unable to embed images so they have to be included via a link).
Thank you
Related
In CRM Online on a customer form is there anyway that you can check if the Associated View for Assets is blank? And if its blank change a field value based on it.
Using JavaScript, 2 ways:
The associated grid is showing records related to your primary record. You can perform the same query the grid is doing using REST which will tell you if there are any records. You can then count the records, and change the field value as required. This approach is better if there are records in the database but which aren't shown in the view for some reason, e.g. view filters.
Access the Grid objects data using getRows(). As above you can then count the records, and change the field value as required. The downside of this is I believe those methods only give you access to the records shown on the form (and not any hidden by filters but still in the database) - but I don't think that that will be a problem here.
Worth bearing in mind that this approach only works client side, e.g. someone has to be actually looking at the form.
If you need to cover the a non-client side approach, e.g. workflows creating records, then you should probably look at plugin development so the changes can be performed server side.
As a side if you just want a simple count shown on form you then you should probably look at Calculated Fields and in particular Rollup fields. You might also be able to run further client side JavaScript from the count.
I'm currently developing my first MVC component for Joomla 3.x. All in all I'm bit struggling with language/translation issues in database.
My problem is that I need to store translated content of user generated content which comes from the backend. For example someone enters a new item in German (stored in database) and needs a translation in another language. How to accomplish that in Joomla? I don't like to generate a new item for every different language when the rest is all the same.
I thought about a table "item" and a table "item_language" with that structure (strongly simplified for viewing purposes):
item
id PRIMARY INT
price DOUBLE(4,2)
item_language
itemid PRIMARY INT
language PRIMARY CHAR(5)
name VARCHAR(50)
In item_language I would like to store the different translated versions. In the language field there would be the region code (eg. de-DE) to identify the language.
My problems:
How to display the different (translated) versions in backend?
Is this the right database model?
Any help is appreciated!
You have really found yourself a nice task for a first component in Joomla!
A rather generalist answer:
The database model seems right. Alternatively you could encode in JSON the language data, but this could make later query operations potentially difficult. This way you will only have one table to work with.
As far as I know (if you are using JModel / JTable to manipulate the data) can't do this directly, as JTable is really only designed to manipulate single tables.
What you can do:
For editing: figure a way to represent this graphically ( for your users to see and edit this one to many relationship) and to post this data (language texts as an array) to JModel. In the model you can maintain the desired relationships and save the data using JTable.
Viewing (without editing) shouldn't be an issue, it would be a simple JOIN.
If you are willing to create a basic component on github, I might even give you a hand with JModel / JTable.
I found a way to deal with the things I needed.
Thanks Valentin Despa for guiding me in the right direction :-).
Here the whole procedure (simplified - validations and exact steps omitted):
Define the form fields in the models/forms/site.xml as normal.
In views/site/tmpl/edit.php add self coded Javascript (based on jQuery) to deal with the fields which have content in multiple languages stored as JSON in database.
Clone the original form element and modify the needed attributes (id, name, ...) to display a special version just for the defined languages. As content - extract the JSON for the needed language from original field content and display.
Hide the original field with Javascript and append the customized versions to DOM.
Afterwards in tables/site.php I read the dynamically generated content withJInput and build together the original field by generating JSON and saving to database.
It's working like expected.
I'm starting with Oracle ADF. I'm trying my first examples with basic components.
Starting from classic HR schema for Oracle ADF (Departments, Employees, Regions, Countries, etc.), I drop a SelectOneChoice for DepartmentsView1, and then I drop a SelectManyCheckbox for related EmployeesView3.
So, the data are well matched and, all employees from selected department are displayed.
Well, my two questions are:
How can I preselect all checkboxes in the SelectManyCheckbox componente? I need that all related employees were preselected.
If I had an input text box, a button and a SelectManyCheckbox component, how can I bind typed value in input box to the query (View Object) and then list the result in the SelectManyCheckbox component?
Maybe they are very basic questions, but I've recently started with Oracle ADF, coming from Java Spring Framwork and I'm changing the problem and programming approach and my mind too.
Any help is very appreciated, because this is a great change for me.
For your first question you've asked, you need to get the binding
(and cast it to JControlListBinding) of the selectManyCheckbox from the bindings
and set its selected values via setSelectedIndices method.
If you want them all to be preselected, you can iterate through all
values, find their indexes, put them in an array and then pass as a
parameter to the setSelectedIndices method.
For the second one,
I have no idea about the reason behind such an operation, but i
guess you could create an appropiate Row with the value the has been
typed in to the box, then you could add it to the RowSet
(via createRow() method of the ViewObjectImpl.) that is bound the selectManyCheckbox.
Maybe because of my rookieness, I don't think that the questions you've asked can considered to be basic. :)
Bonne chance in your ADF adventure by the way.
I am trying to do an oddball type of query to a database that I cannot seem to figure out how to do.
I made a sample database, shown below, just for this question, as I cannot display the real database because of its proprietary nature.
http://i.stack.imgur.com/DGDaQ.png
My goal is to be able to add an order and order items on the same page, while displaying a list of the products as shown below.
http://i.stack.imgur.com/QLMrB.jpg
Not every order will contain all of the products, but I still need to be able to list all of the products and have the ability to enter a quantity if there is one. How would I go about laying this out using MVC? Currently, I am using a ViewModel inside the Create View for the Orders to display the ProductName list. I cannot seem to figure out how to get boxes that would allow me to add in the OrderItems information for each product name.
I have a working system that lets me build a database containing instances of various entities , all linked together nicely.
Before I knew I would care, I came across a tutorial on using Core Data and bindings, and it went through a complete case where you get a table showing all the entities of some type with a column for each property. It showed both the UI side and the Data model side - not that I need the data model part at this point. Now, darned if I can find it. This is one of those things that is supposed to be easy, and requires virtually no code, but getting exactly the right connections in UIBuilder is not going to happen if I can't find instructions.
Also, I thought I came across an example of something like a query editor where the user could select which properties to sort on, which to match on, etc. Did I imagine that?
Anyone out there know where I can find such?
Sure, you can do this without code:
Add an array controller to your nib.
Bind or connect an outlet for its managed object context
Set the array controller to Entity mode, fill in the entity name, and select Prepares Content.
Bind your table view columns to array controller's arranged objects, and fill in the key name for the model key.
Regarding the query editor, open up the model, and on the Editor menu click Add Fetch Request.
I found at least a partial answer to the query editor question, in this apple tutorial. Not sure how far it will get me, as I prefer to write code where possible, since then I can leave a trail of comments.