Synchronization between AOT and DB - Will I lose data? - axapta

I am new to AX 2009. I am adding a new field to the Tax 1099 tab for vendors to store additional info. I created a new extended type that is a 9 char. string. When I create a new string field on the VendTable the default length is 10. I then change it to use my extended type (9 chars in length). When I try to save the changes I get the text that says "...could result in data truncation". I know that is fine because this is a new field and there is no data in the db yet.
BUT - I also get the message "The action you have taken will drop and re-create the table VENDTABLE and all associated index. This can be caused by renaming a field or changing the type and/or size of the field."
It's unclear to me if it is ok for me to continue. If I continue will I loose all the data in my VENDTABLE or will the data be re-created along with the table?
I've read the information here but I'm still unsure if I will loose my VENDTABLE data or not if I continue.

The system will create a new table with the new field size, copy all the data from vendtable to the new table (truncating data in your 1099 field), then delete vendtable and rename the new table to vendtable.

Related

How to save an untouched new record

after reading a lot in this forum (and also in others), I still haven't found a solution for my problem. It's a classical scenario : a Customer creates an Order, which in turn has OrderItems.
So my tables are as follow :
tbl_Customer
cust_Id as Long (primary key, autoincrement)
cust_Name as String
cust_Adress as String
cust_Phone as String
etc
tbl_Order
ord_Id as Long (primary key, autoincrement)
ord_CustId as Long (references as foreign key field cust_Id in table tbl_Customer)
ord_Date as Date
tbl_OrderItem
oi_OrdId as Long (references as foreign key field ord_Id in table tbl_Order)
oi_ArtId as Long (references as foreign key field art_Id in table tbl_Article which is not relevant in this scenario)
oi_Count as Integer (quantity of article(s))
oi_Price as Double (price of article)
As you can see it is a not so complicated m:n relationship between customers and articles which are ordered.
Beside these tables I created in Access a form frmCustomer (based on tbl_Customer) which owns a subform frmOrder (based on tbl_Order). These two forms are connected by fields cust_Id and ord_CustId.
SubForm frmOrder in turn has a subForm frmOrderItem (based on table tbl_OrderItem). They are connected by fields ord_Id and oi_OrdId.
Some example data inserted in these tables are shown correct. Switching customers results in showing its orrders and orderitems. So far so good.
Now I want to insert a new order, and adding some orderitems to it.
If I click on button "New empty record" (record-navigation pane) of subForm frmOrder, a new empty order-record is created with empty fields and empty subform orderitem.
When I now insert a new orderitem and try to store it, an error message appears, saying the record cannot be stored because field oi_OrdId cannot be null.
That's true, because the order-record is not yet stored, and hence autoincremented field ord_Id is not yet filled. Only if I edit a field in the until now untouched order-record (for example orderdate) and leave that field, the record is stored, and the field ord_Id is filled, and also field oi_OrdId in form frmOrderItem.
But, because the fields ord_CustId (=[Forms]![frmCustomer]![cust_Id], value copied from parent form frmCustomer) and ord_Date ( =Date() ) have default-values, I don't want to edit a field first.
I would like to enter immediatly orderitems.
Is there an event (-procedure) I can use to save the untouched order-record (how ?) automatically, when I enter a field of subform frmOrderItem ?
Or has somebody of the community a helpful solution ?
And by the way, is there a way to access a new, not yet saved record ?
Thank you very much in advance for your help
ulofb
Now I want to insert a new order, and adding some orderitems to it. If
I click on button "New empty record" (record-navigation pane) of
subForm frmOrder
Don't. Do it the other way round. Block record inserts in the subform for a new order record. After insert/save of the order form, enable record inserts in the subform.

How to get the selected Lookup value from a custom Lookup from ax2012

Dears,
I'm using Microsoft Dynamics AX2012 R3
The Case: I want to make a custom lookup in Inventory Management ==> Journals ==> Item Transactions ==> Movement ==> Lines
I want to relate the Item Id to show all lines in the SalesLines Table in order to get the ItemId and It's dimensions (Config/Size/Color/Style) and when I select it I want to move the selection to the movement line.
My Solution:
Step1: I've made a custom view (viewCustomItemId) that shows all SalesLines tables and related to InventDim to show the dimensions.
Step2: I've made a custom form (frmCustomItemId) and added the view (viewCustomItemId) as a datasource and added all fields to a grid
Step3: In the form (InventJournalMovement) I've overrided the lookup method and added below code
Args args = new Args();
viewCustomItemId _viewCustomItemId;
args.name(formstr(frmCustomItemId));
args.caller(element);
newPopup = classFactory.formRunClass(args);
this.performFormLookup(newPopup);
newPopup.init();
newPopup.wait();
if (newPopup.closedOk())
{
_viewCustomItemId = newPopup.docCursor();
InventJournalTrans.ItemId = _viewCustomItemId.ItemId;
InventDim.configId = _viewCustomItemId.configId;
InventDim.InventSizeId = _viewCustomItemId.InventSizeId;
InventDim.InventColorId = _viewCustomItemId.InventColorId;
InventDim.InventStyleId = _viewCustomItemId.InventStyleId;
InventJournalTrans_DS.research();
}
Problem: When the lookup form is closed all fields are set to the movement line but I get warning message (Field 'Item number' must be filled in.) and the line number in the database are set to be minus for this line and also the default site and warehouse for this Item is not automatically set.
Question: Looks like I've retrieved the values but didn't pass it correctly to the lookup of the field, I don't understand what exactly I missed to make it work normally.
Thanks in advance.
I'm surprised I missed this at first glance.
This line is your problem:
InventJournalTrans_DS.research();
You're researching before you've updated/written the data. I'm not sure why you're researching in the first place, but you have to do one or the other. Write/Update, then research or don't research. The research is where you're losing the ItemId you've input.

Internal : Collection fields are defined but cannot be matched to the incoming collection - in blueprism

I want collect Financial historical data from NASDAQ link https://www.nasdaq.com/symbol/ge/historical. In this I am spying date element and using "get table" I can get whole table data for date, open, high,... which I am putting in collection but the thing is I am not able to give column name to collection. I made 6 field for each all 6 column you can see in image attched. But when i run the programv I get an error "Internal : Collection fields are defined but cannot be matched to the incoming collection - The collection definition does not contain the field Column1". if I dont add field I get data in collection which has default column name column 1, column 2, ...column 6 . But I want to have their specific column name. I think the problem is with the data type I am using while creating field in collection. I tried different combination for the data type but still...Please help me on that. enter image description hereimage 1image 2
image 3image 4
The error is exactly as it says; the fields cannot be matched; in other words, the fields should match. Since you get default field names from the Read stage, then you should either rename the fields before passing the collection to the process or have the collection receiving the collection at the process level have no fields defined (it will get the headers defined from the object and you can rename the fields after that, or just use the default column names, but that's not practical).
To rename the fields, you can use the default object "Utility - Collection Manipulation", either actions "Rename Collection Fields" or "Rename Field".
Rename Collection Fields
You will have to supply the collection containing the read table (Main Collection) and a collection containing the same headers as the collection containing the read table (New Headers), and in the first row, the new headers (it was designed like that, it's not that intuitive; it took me a good while to figure it out). The collection New Headers should look like the below:
Rename Field
For this one, you will need to loop over each header. Collection In will be the collection containing the read table, and you insert each header to change one at a time. (e.g. first loop iteration will have Column1 as Field Name and date as New Name, second loop iteration will have Column2 and open, etc)

Lookup field appears as numerical values instead of text on Access report

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!

How to describe (enumerate) picklist enties valid for a specific record type in Salesforce?

In apex code I want to enumerate the legal values for a picklist field. To do this I can just call Account.Foobar__c.getDescribe().getPickListValues() and I've got a list of Schema.PickListEntry values.
However it's possible to setup multiple record types for a given sObject. For example Account might have "Manufacturer", "Distributor" and "Retailer" record types. In the Salesforce setup it is possible edit (limit) the picklist entries for each field based on record type. So Retailer type accounts might only use a subset of the picklist values for the Foobar field.
So basically I want Account.Foobar__c.getDescribe().getPickListValues('Retailer') however this is not the syntax. The validFor method looks promising, but it seems like it is only for field dependent picklists - a picklist filtered only by record type returns false for isDependentPicklist.
I know this is an old post, but maybe the info below will help someone who still needs the answer.
I found here that one can actually get a list of record type specific picklist values by making a describeLayout() call.
Using your example (C#):
DescribeLayoutResult result = binding.describeLayout("Account", new string[] { "01230000000xxXxXXX" } );
PicklistEntry[] values = result.recordTypeMappings[0].picklistsForRecordType[12345].picklistValues;
Replace "01230000000xxXxXXX" with a RecordTypeId of your Retailer record type object. Use the query "SELECT Id FROM RecordType WHERE Name = 'Retailer'" to get the value.
Replace 12345 with an index of your picklist object that you would like to get values of.
You can't do it in pure Apex AFAIK, unfortunately. The metadata API does expose it.
Related opinions: http://boards.developerforce.com/t5/Apex-Code-Development/Any-way-to-obtain-picklist-values-by-record-type/td-p/287563

Resources