I have a read-only access to our Redmine DB (MySQL). This rights were given to me so I could build some reports.
And now I am facing a problem.
I got an issues table and there is a field named priority_id. How can I get priority names (like Normal,Urgent etc that represent each id)?
I searched DB/SO/google but couldn't found where this values are stored, only Priority Plug-in for Redmine.
Redmine stores the defined priorities as well as other similar data (like time entry activities or document categories) in a database table called enumerations. The defined enumerations can be shown with this example SQL:
SELECT name FROM enumerations WHERE type = 'IssuePriority' ORDER BY position ASC;
To associate the priority to issues, you can e.g. use
SELECT issues.id, issues.subject, enumerations.name FROM issues LEFT OUTER JOIN enumerations ON issues.priority_id = enumerations.id AND enumerations.type = 'IssuePriority'
On the Redmine web interface, you can edit the data in Administration -> Enumerations.
Related
We have some tables in our database that all have the same attributes but the table is named differently for each. I'm not sure of the Architect's original intent in creating them in this way, but this is what I have to work with.
My question for all the expert Oracle APEX developers: is there away to create a reusable page that I can pass the table name to and that table name would be used in the reporting region and DML processing of that page?
I've read up on templates and plugins and don't see a path forward with those options. Of course, I'm new to webdevelopment, so forgive my ignorance.
We are using version 18.2.
Thanks,
Brian
For reporting purposes, you could use a source which is a function that returns a query (i.e. a SELECT statement). Doing so, you'd dynamically decide which table to select from.
However, DML isn't that simple. Instead of default row processing, you should write your own process(es) so that you'd insert/update/delete rows in the right table. I've never done that, but I'd say that it is possible. Basically, you'd keep all logic in the database (for example, a package) and call those procedures from your Apex application.
You could have multiple regions on one page; one region per table. Then use dynamic actions to show/hide the regions and run the select query based on a table name selected by the user.
Select table name from a dropdown or list
Show the region that matches the table name (dynamic action)
Hide the any other regions that are visible (dynamic action)
Refresh the selected region so the data loads (dynamic action)
If that idea works let me know and I can provide a bit more guidance.
I never tried it with reports, but would it work to put all three reports in a single page, and set them via an Item to have Server-Side Conditions that decide what gets shown in the page? You'd likely need separate items with a determined value for the page to recognize and display.
I know I did that to set buttons such as Delete, Save and Create dynamically, rather than creating two or more separate pages for handling editing of certain information. In this case it regarded which buttons to shown based on a reports' primary key being sent to said "Edit" page. If the value was empty, it meant you wanted to create a new record (also because the create button/link sent no PK). If said PK was sent (via a edit button/link), then you'd have the page recognize it and hide the create button and rather show the edit button.
In Dynamics CRM online, I can add a list of entities to another entity, for example a list of products to an opportunity.
Is there any way I can have a list that is not picked from pre-populated items, e.g. just a simple list of {number, date, text} that you type in each time you want to add to the list, not picking items from a pre-defined list.
I am just using the web interface to customise at the moment, but I am open to any suggestions.
EDIT:
So far i have;
Created two entities, proposal and proposal version
Added a 1:N relationship between proposal and proposal version
Added a sub-grid to the proposal form, tried to make it editable but it refuses to work
This lets me add new rows by opening up the proposal version form and adding a new one or picking from already created ones for other proposals but that is rather clunky for a simple list.
I don't want it to offer to search for previous entries, just let me add to the list by typing stuff in, surely this should be fairly simple?
If you want a pre-defined list of items that are simple (number, date, text..) then you can create an option set field in CRM. These lists are fixed and can only be extended by customising the system. An example option set field might be Organisation Type:
Prospect
Site
Head Office
...
If you want a pre-defined list that can be extended, you need to create a new entity. Following from the previous example, you would create a custom entity called Organisation Type and then create a record for each type you wanted, populating only the name field with the type: Prospect, Site etc.
Then you would add a lookup field pointing to the Organisation Type entity on any other entity that used the field, such as Organisation (Account).
You see how the custom entity still appears as simple data because you're only populating the name field, which can be text, a number etc. You can also apply security roles to this entity, limiting which users can create and delete options from your list.
Edit: to only allow the creation of new records in a subgrid, make sure the lookup attribute to the parent entity on the child entity is business required.
I have to maintain an App with a SQL Server 2012 back end.
There's a database table containing a bunch of
machine parameter settings, one per column.
Each parameter is an nchar(15) type referencing
a type-dependant lookup-table, e.g.
CREATE TABLE L_MachineSettings (
ID uniqueidentifier NOT NULL PRIMARY KEY,
ParentID uniqueidentifier,
IsActive nchar(15) FOREIGN KEY REFERENCES L_YesNo(Constant),
OnTime nchar(15) FOREIGN KEY REFERENCES L_Time(Constant),
Motor1_InitMode nchar(15) FOREIGN KEY REFERENCES L_InitModes(Constant),
...
and so on (nearly 60 parameters are following, some are ref. the same lookup-tables)
...
)
Each lookup table is built like in this example:
CREATE TABLE L_Lookup_YesNo (
Constant nchar(15) PRIMARY KEY,
TargetValue nvarchar(max),
NotSupportedBy nvarchar(max)
)
INSERT INTO L_Lookup_YesNo
(Constant, TargetValue)
VALUES
(N'No', N'0'),
(N'Yes', N'1')
There are several different machine types among whom, some are not capable
of accepting all values of all lookup tables due to their limited hardware specs.
For those, the field NotSupportedBy in the lookup tables is filled with the machine types not
supporting a value, separated by semicolons, e.g.
INSERT INTO L_Lookup_InitModes
(Constant, TargetValue, NotSupportedBy)
VALUES
(N'Standard', N'144A', NULL),
(N'Extended, N'144B', NULL),
(N'ExtendedPlus' N'144Z', N'AU1220;AU1221'),
(N'ExtendedPlusB' N'144D', N'AU1220;AU1221;AU1401')
The machine types itself are defined in a separate table:
CREATE TABLE L_MTypes (
Name nchar(6) PRIMARY KEY,
Comment nvarchar(max)
)
INSERT INTO L_MTypes
(Name, Comment)
VALUES
(N'AU1220', N'Basic Edition'),
...
A L_MachineSettings row is allowed to be only partially implemented
so it can contain NULL values, as long as it's ParentID
property has been set to another row ID containing the missing
parameters.
Also child row values will overwrite those of the parent's row,
so a hierarchic parameter structure can be build by creating a base setting
and adding only differing values for a new setting while referencing
all other values. If a base value is to be changed, the change "falls through" to
it's childs automatically, so XML files, which represent the final format
of the data, shipped to customers are always containing all recent changes.
I'm now challenged with the job of making those column-lookup-values
machine specific, too, while not throwing the existing database layout
on the heap.
So what I need is a way to store more than one lookup value into a settings field,
which would be associated with a machine type. If no specific value for a specific machine
type is available, the general value should be used on export. The machine-specific values
should be taken from the lookup tables, too.
An important thing is: Next to a GUI (written in C++Builder) some users are also
accessing the SQL Server DB via MS Access and those users are not qualified personnel in terms of databases (you know
what I mean), so there should be only minor changes to the existing structure.
My ideas so far:
Adding a new column MType to L_MachineSettings to add machine specific options to the ParentID setting
Adding machine specific values via semicolon-separation to a field, e.g. "Yes;AU1220:No"
While the first idea seems simple at first, I fear the collisions with the ParentID stuff and the probably resulting chaos.
The second approach will give up the existing lookup relationships, (only breaking that with the lookup-tables NotSupportedBy column until now), so I won't accept that change.
Who has some best practices for me, here?
I have created two new tables in our Dynamics NAV 2013 installation: 50086 Order By Period and 50089 Item Sales By Period. Each contains Date, Decimal, Integer and Text fields, as well as the Code fields used in the key. I left all field properties as their defaults. When referring to the tables in my codeunit some, but not all, of the fields cause compile errors because they are not recognised, with the error "You have specified an unknown variable." In the codeunit I have the tables referenced as local variables of type Record.
I have tried a number of different ways of referring to the table fields in case the error was in the code but all cause the same error. My current code is:
ItemRevenue.VALIDATE("Last Period Orders", 1);
Recompiling the objects (tables and codeunit) has not fixed the problem. In order to force the compiler to use the latest version of the tables I have removed all references to the tables from the codeunit, recompiled the tables, then added the references back and recompiled the codeunit. This hasn't corrected it, the same fields are still causing compile errors.
All the table fields are present in the SQL Server tables.
What should I do to make all the new table fields visible to the compiler?
If you adding fields to table while having codeunit referencing the table opened then C/AL will throw this error until you reopen codeunit. This is the only way to refresh table definition for codeunit.
However if the codeunit declared as SingleInstance then just reopen codeunit is not sufficient. You have to restart client application or as it called in newer versions Development Environment. That will refresh table definition for singleinstance codeunit.
I never worked out why the compiler didn't recognise the table field names but using the C/AL Symbol Menu to add the field names instead of typing them, or copying and pasting them from the table definition, created compilable code. To the human eye there was no difference in the field names but the compiler recognised the field names inserted via the C/AL Symbol Menu whereas it hadn't recognised them before.
I'm finding myself with a django project handling two distinct classes mapped on a similar table name:
class BarA(models.Model):
[...]
class Meta:
db_table = 'bar' # doesn't specify any schema
class BarB(models.Model):
[...]
class Meta:
db_table = u'foo"."bar'
The project is using a database containing two schemas: public and foo.
The way this application is templated and deployed makes things even more confusing: on some servers, django connects to database with the user "John", not member of any role, but on other servers it connects with user "Eric", member of a foo role.
Two questions here:
If django's meta class doesn't mention any specific schema, how does Postgres decide which table it will work with ? So far, it appears that user Eric will always hit the foo.bar table, and never the public.bar one, regardless of the called class.
With user "John", I'm only using BarA class and it properly hits public.bar.
Django doesn't seem to handle schemas; is this solution considered as a good practice for that kind of case (please note that I cannot rename the existing tables)?
In postgres search_path variable set the priority for choosing the schema for the table:
search_path (string)
This variable specifies the order in which
schemas are searched when an object (table, data type, function, etc.)
is referenced by a simple name with no schema specified. When there
are objects of identical names in different schemas, the one found
first in the search path is used.
[...]
The current effective value of the search path can be examined via the SQL function current_schemas.
A quick way to do so:
SELECT current_schemas(True);
You can find details on how to manage search_path in section 5.7.3. of this article: http://www.postgresql.org/docs/current/static/ddl-schemas.html