I need to generate a report that groups by two fields the records of a table in an Axapta 3.0. The source table I have has this structure:
And the report I want to get looks like this:
What sections and properties should the report have in order to create such a design?
Thank you very much.
If you have backing tables for the fields 'LOTE' and 'DIARIO' then the easy option is to use them, the query should look like this, all inner joined:
LoteTable
DiarioTable
YourTable
Remember to set Relations to Yes on the two first tables (or define the relations your self).
If you do not have backing tables, you can create them as views on your table.
The LoteTable view should contain the following fields:
Lote
Proveedor
CountOfRecId (Aggregation Count)
The CountOfRecId field will make the view a group by on the first two fields.
Related
I have a InvoiceAccount field in table. And another field in this table is PackingSlipAXType. If PackingSlipAXType is Sales, InvoiceAccount field value is customer account. If type is PurchReturn, InvoiceAccount field value is vendor account.
When value is customer account, when right click and go to main table i want to go Customer
and
When value is vendor account, when right click and go to main table i want to go vendor.
How can i do this in same field?
There are two primary ways. One is code and the other is using native MorphX and Conditional Table Relations. Code gives you more flexibility, but conditional table relations are simpler and "just work".
Conditional Table Relations
Using conditional table relations. I created a new table and AccountNum would represent a customer or vendor account, and the base enum SalesPurch is used to indicate if it is a Customer Account (Sales) or a Vendor Account (Purch). Similar to your setup.
See conditional table relations - https://learn.microsoft.com/en-us/dynamicsax-2012/developer/conditional-table-relations
See here for more info too.
Custom JumpRef & Lookup
You will likely want both a jumpRef and a lookup to both go to the correct main table and lookup the correct values.. This is code, but you have all the flexibility in the world...but may not need it.
Jumpref - https://community.dynamics.com/365/financeandoperations/b/faisalfareedaxlibrary/posts/ax-2012-how-to-use-jumpref-method
Lookup - https://learn.microsoft.com/en-us/dynamicsax-2012/developer/how-to-add-a-lookup-form-to-a-control
Jumpref example at \Data Dictionary\Tables\TmpCostAllocationBase_RU\Methods\jumpRefAgreement
Lookup example at \Data Dictionary\Tables\TmpCostAllocationBase_RU\Methods\lookupAgreement
I am struggling in the creation of a report including four tables.
Those tables should be the same for each account. I use just one dataset. When I run the report, the data is good, but tables listing appears wrong.
First all BALANCE DETAIL tables for all accounts selected are listed, then all DEBIT TRANSACTION tables for all accounts selected are listed etc.
For each account the page should show up just like this
Please give me an easy-to-understand answer since I am really a beginner in this sector.
It might be easier to this with 5 separate datasets, but I think you can do it with just on also.
Create on 'main' table on the dataset. use 4 detail rows, 1 column
Group it on accountnumber
In each detail of the main table, insert a new table with the same dataset.
Group those sub-tables also on accountnumber
Add a filter to the subtables. set the subtable accountnumber equal to the outer table account number (you can use the expression builder, but it should read something like this: row['ponum'] equals row._outer["ponum"] )
Good luck!
I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!
Say I have three entities: Page, Product and Media.
Well, I would like to have this realations:
Page <-(many-to-many)-> Media
Product <-(many-to-many)-> Media
Using the common approach for solving this, it would result two tables that look very similar.
My question is: Can I use a single table for both relations using Doctrine?
What I only need is a way of suggesting a new column that would indicate if the counterpart of media on a particular row is Product or Page.
The answer is No. Relations table N:N must have unique table name.
But... You can aways create a structure of that kind:
Page <--1:N--> MyGreatJoinTable <--N:1--> Media
Product <--1:N--> MyGreatJoinTable <--N:1--> Media
You don't need to describe the reference because it refers to a different table, but if you want you can do it.
Of course MyGreatJoinTable will have at least three columns:
- PageId
- ProductId
- MediaId
i'm using Drupal 6
I have this table relation and I've translated into CCK complete with it's relation.
Basically when I view a Period node, I have tabs to display ALL Faculty nodes combined with Presence Number.
here's the table diagram: http://i.stack.imgur.com/7Y5cU.png
Translated into CCK like these:
CCK Faculty (name),
CCK Period (desc,from,to) and
CCK Presence(node-reference-faculty, node-reference-period, presence_number)
Here's my simple manual SQL query that achieve this result: http://i.stack.imgur.com/oysd3.png
SELECT faculty.name, presence.presence_number FROM Faculty AS faculty
LEFT JOIN (SELECT * FROM Presence WHERE Period_id=1) AS presence ON faculty.id=presence.Faculty_id
The value of 1 for Period_id will be given by the Period Node ID from the url argument.
Now the hardest part, is simulating simple SQL query above into Views. How can I make such query into Views in Drupal-6 or Drupal-7 ?
thanks for any helps.
The main issue, which I think you've noticed, is that if you treat Faculty as the base for your join, then there is no way to join on the Presence nodes. Oppositely, if you treat Presence as the base, then you will not see faculties that have no presence number.
There is no easy way, using your currently defined structure, to do these joins in views.
I would say your easiest option is to remove the 'node-reference-faculty' field from the presence node and add a node-reference-presence field to the faculty. Since CCK fields can have multiple values, you can still have your one-to-many relationship properly.
The one downside of this is that then you need to manage the presence-faculty relationship from the faculty nodes instead of the presence nodes. If that's a show stopper, which it could be depending on your workflow, you could have BOTH node-reference fields, and use a module like http://drupal.org/project/backreference to keep them in sync.
Once you have your reference from faculty -> presence, you will need to add a relationship in Views. Just like adding a field or a filter, open the list of relationships and find the one for your node-reference field.
Next, you will need to add an argument for period id and set it up to use a node id from the url. The key thing is that when you add the argument, it will ask which relationship to use in its options. You will want to tell it to use your newly added presence relationship.
You don't really need to do a subquery in your SQL like that. This should be the same thing and won't make mysql try to create a temporary table. I mention it because you can't really do subqueries in Views unless you are writing a very custom Views handler, but in this case you don't really need the subquery anyway.
Ex.
SELECT f.name, p.presence_number
FROM Faculty AS f
LEFT JOIN Presence AS p ON f.id=p.Faculty_id
WHERE p.Period_id=1;
I wrote an article about how to achieve a similar outcome here. http://scottanderson.com.au/#joining-a-views-query-to-a-derived-table-or-subquery
Basically how to alter a Views query to left join on a sub-query.