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.
Related
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.
Iam new to Informatica,I have to add two new fields(AREA,AMT) to an already existing SQL query in Informatica. After this should I manually add the source qualifier port with these two fields?
What I did was:
1) Changed the query in SQL qualifier in Mapping designer- added the two new fields, saved the mapping
2) Refreshed the workflow in Workflow designer
3) Monitored the result in Workflow Monitor which was successful.
Now, the resulting text file has the new field values but no column header names. Hence the column header values are shifted resulting in column name and value misalignment.
Any help on this is appreciated.
Thanks!
YES you should manually add the two ports to the Source Qualifier. The number of fields selected in the SQL query should match the number of ports in the Source qualifier which are linked to the next transformation.
Interestingly Informatica maps the fields from the SQL query to the Source qualifier output links instead of Source Qualifier ports. So the first column in the SQL query gets mapped to the first link, second column to the second link and so on.
For your header issue, you should let us know how you are generating the headers for the output file. If you are using "Use header command output" option in the target file session properties for generating headerthen you have edit the command to create header for there two new ports as well.
I have table A-Z. Table A has PK of ID, and all other tables has fields that relates to TableA's ID.
I'm being tasked to do code cleanup, and I need to change the TableA's ID from length 30 to 20. I have done for other table B-Z, together with the upgrade codeunit. But when I try to change for TableA, I get this error:
"The are changes related to the following primary key that can cause data loss in the new table. The changes cannot be handled because the TableUpgradeMode of the TableSyncSetup type function for the changed table is set to Copy, which does not copy data to the new table. To fix this issue, you must change the TableUpgradeMode option to Move, then add C/AL code to an Upgrade type function to handle new table data."
What does the error mean? Do I need to change TableA's upgrade codeunit from TableSyncSetup.Mode::Copy to ::Move? Any guidance?
I'm using Dynamics NAV 2016.
Yes, you have to change the mode to Move but you also have to create a new table which holds the data temporarily from the fields where you've reduced the field length. You also have to handle the possible data truncation issue because of the reduced field length.
But I would do this in a different way (the old way from the Upgrade Toolkits):
- Create a new table with the same field length (30), copy the field contents and clear the fields (using a codeunit)
- Change the field lengths and but choose Force when NAV is asking about the Sync Mode (because you know that there is no data in those fields - SQL can drop and recreate the columns)
- Using a second codeunit copy the data back into the reduced fields - handle the truncation
I hope it helps
I have a question about a strange behavior in the Translatable extension.
I have two tables, one called pages, and one called pages_translations in which I've the translation of my title|subtitle|text fields.
When I save for the first time a record, in the table pages I've title|subtitle|text fields that contains my default locale, and in the pages_translations both English, Italian, French etc...
If I change all the translation in my pages_translations table I've the right changed values, but in my pages tables I've have the old record with the first data saved.
This is not a big problem because when I call getTitle() or similar Doctrine takes the right value in the pages_translations table, but I don't like having the old values in my pages tables, there is a way to update also the pages table or (better) delete the title|subtitle|text fields because this fields doctrine really don't need.
I'm trying to do a proof of concept using SubSonic 3 but Sstraight away i'm hitting numerous errors with the generation. I started making alterations to the generator settings but that seems a little odd when I'm just trying to do a simple one to one mapping of my DB.
Firstly I found an SP that had #delagate as an SP parameter name, this was easily fixed, but should probably be in the standard templates as a user shouldn't have to make template changes for this simple an issue.
Next I found that the system choked on two tables and tried to create signatures the same
the tables where
Field
Fields
now i know SubSonix 2 had a fixPluralClassName property but buggered if I can find one in the template for SubSonic 3
Any help on that one will get me started
Generally 'X' and 'Datum' type appendages/substitutions happen when you have used a 'reserved' word in a column or table name. In this case 'Reserved' being a word that Subsonic doesn't like to use for data objects.
A couple of rules I follow are;
Ensure both table names and column
names are not 'reserved' words (ie
'Data' or 'Int' or 'Table')
Ensure that each table has a primary key
Don't use date and time column types
as they are not supported yet
(DateTime is, just not Date and Time types)
Don't have a column with the same
name as the table
The Subsonic FAQ might be helpful.