Import Item tagged with 1 added

4.05K viewsDataLink
0

I have attached a model of a single matrix with a datalink and a text file to illustrate the problem encountered.
The text file has one line of data which the item matches with the matrix. However, when I do a datalink/update, the item is added to the matrix as a “new” item with a 1 tagged behind (ie Staffa 1). Why does this happen? What should I do so that the data (ie 5) is updated to the existing matrix of the existing item using datalink from a text file? Thanks.

0

Hello Sally – Thanks for the post:

It looks as though this original Type category item was created by a DataLink from a different source file. Looking “under the hood” can see the original name of the item was ‘Headcount’ and then it was renamed to Staffa. Therefore, when the Staffa item from the new source file is directed towards the type category, it can’t merge with the item because the original name was headcount.

We do this to allow users to change item names in the matrix, without having to change the name of the item in the back end .csv file or database. But it can present some problems if the actual data source column name is changed along with the item name in the matrix being changed.

That said, if you create a new matrix with the data source, as done in the attached model, you can then change the values in the data source and update the DataLink, and the items stay as they are.

We do have an additional plugin you can install that allows you to ‘see behind the scenes’ as to what the original item names are for an item, and change them as needed. If you would like to install and explore this plugin functionality please contact [email:240ag53x]support@quantrix.com[/email:240ag53x].

This is a long answer but I hope you find it helpful.

-Mike

0

I have a similar problem, but I have that my DataLinks are performed through a QAction. Is it possible to access to the “original name” of an item (and change it if needed) via QAPI?

Thanks,
Davide

0

[font=Arial:6ethes2y][size=84:6ethes2y]Yes, the original name is a property of the item and QAPI can access node properties. [/size:6ethes2y][/font:6ethes2y]

[font=Arial:6ethes2y][size=84:6ethes2y][b:6ethes2y][color=#7f0055:6ethes2y]public[/color:6ethes2y][/b:6ethes2y][b:6ethes2y][color=#7f0055:6ethes2y] void[/color:6ethes2y][/b:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y] performAction(QActionContext context, QActionEvent event)[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y] [font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]{
[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#3f7f5f:6ethes2y] // Get the desired node. In test12345.model it's the only[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#3f7f5f:6ethes2y]
// item on the “type” category.
[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y] Model model = context.getModel();[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]
MatrixView matrix = model.getMatrixAt(0);
[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y] Node category = matrix.getCategory([/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#2a00ff:6ethes2y]”type”[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]);[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]
Node item = category.getChildAt(0);[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y]

[b:6ethes2y][color=#7f0055:6ethes2y]final[/color:6ethes2y][/b:6ethes2y][/size:6ethes2y][/font:6ethes2y] [font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y] String key = [/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#2a00ff:6ethes2y]”com.quantrix.dataimport.ImportName”[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y];
[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]System.[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][i:6ethes2y][color=#0000c0:6ethes2y]out[/color:6ethes2y][/i:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y].println([/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#2a00ff:6ethes2y]”Original name: “[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y] + item.getProperty(key)); [/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#3f7f5f:6ethes2y]//”Headcount”[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y]
[font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]item.setProperty(key, [/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=#2a00ff:6ethes2y]”Staffa”[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]);
[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y][color=black:6ethes2y]}

[/color:6ethes2y][/size:6ethes2y][/font:6ethes2y][font=Arial:6ethes2y][size=84:6ethes2y]You will need at least version 3.1.006 of Quantrix Modeler for this to work. Before that version, there was a bug that would cause[color=black:6ethes2y] item.getProperty[/color:6ethes2y]() to return null for this particular property.

[/size:6ethes2y][/font:6ethes2y]

0

Thank you Bryan. I tried your action with Quantrix 3.1.006 (on Windows) and did not work ( item.getProperty() returned null ).
However it works for Quantrix 3.1.010.

Davide

0

Correct. 3.010. I just discovered my mis-version.