Keyword replacement: Link id for the current asset

Hi guys,


I need a keyword replacement for an assets current link id.



I am working on an implementation of a way for assets to be movable from the front-end and this is last piece of the puzzle!



Hope one exists!



Cheers,

i don't think there is keyword for linkid,
If i'm not wrong, you need this linkid to send post data to matrix to modify the asset location? You might be able to use DB Data Source to query the linkid of the current asset (using dynamic parameter for current assetid). And use an asset listing to list the result of the DB Data Source, you will get the linkid of the current asset. If the asset is linked under two or more location, the asset listing will return more than one result, one linkid for each parent that it is linked under. How would you deal with this?

[quote]I need a keyword replacement for an assets current link id.


I am working on an implementation of a way for assets to be movable from the front-end and this is last piece of the puzzle!



Hope one exists![/quote]

Unfortunately there is not a keyword for the current link ID of an asset. An asset can be linked under multiple parents so there is not a direct one-to-one relationship.



However, assets can be moved from the frontend by using the Link Manager asset. It might be possible to integrate your implementation with a Link Manager configured with dynamic root and managed asset nodes, and provide the appropriate HTTP request to perform the move.

Hi Mark,


Thanks for the reply.



I have an implementation with the Link Manager as well, however I would still need to "Unlink" an Asset from its current location (where the user clicked the delete from originally). Hence why I opted for the "Move" idea.



Is there any way to "Unlink" an Asset from a Root node using the Link Manager? I can't see any option that allows me to do this.



Cheers,


[quote]Unfortunately there is not a keyword for the current link ID of an asset. An asset can be linked under multiple parents so there is not a direct one-to-one relationship.



However, assets can be moved from the frontend by using the Link Manager asset. It might be possible to integrate your implementation with a Link Manager configured with dynamic root and managed asset nodes, and provide the appropriate HTTP request to perform the move.[/quote]

Hi Huan,


The DB Data Source is a tangible idea, however I am not familiar with the database schema that Matrix has. Is there a diagram anywhere that I can have a look at?



However, I can also see a way that its possible for Matrix to determine which Link ID is associated with which Root node. The Link Manager screen already does this quiet well and hence why I assumed there will be a keyword for this hidden somewhere.


[quote]i don't think there is keyword for linkid,

If i'm not wrong, you need this linkid to send post data to matrix to modify the asset location? You might be able to use DB Data Source to query the linkid of the current asset (using dynamic parameter for current assetid). And use an asset listing to list the result of the DB Data Source, you will get the linkid of the current asset. If the asset is linked under two or more location, the asset listing will return more than one result, one linkid for each parent that it is linked under. How would you deal with this?[/quote]

You're right that it would be simple to write a keyword to a/the link ID, but the keyword does not exist. Anyway,

    select linkid from sq_ast_lnk where minorid = 'asset_id';


where asset_id is the current asset id... in this table majorid is the root node, minorid is obviously the linked asset.

There's a chance your assets will have many linkid's as mentioned previously.. I know some of ours have quite a few. You'd need to know the 'real' asset id you want to keep and delete the others, possibly by using the 'updated' field in the sq_ast_lnk table? Sounds slightly scary to me.

[quote]You're right that it would be simple to write a keyword to a/the link ID, but the keyword does not exist. Anyway,

    select linkid from sq_ast_lnk where minorid = 'asset_id';


where asset_id is the current asset id... in this table majorid is the root node, minorid is obviously the linked asset.

There's a chance your assets will have many linkid's as mentioned previously.. I know some of ours have quite a few. You'd need to know the 'real' asset id you want to keep and delete the others, possibly by using the 'updated' field in the sq_ast_lnk table? Sounds slightly scary to me.[/quote]

Thanks for the information.

I wouldn't be doing any sort of deleting by directly injecting SQL, but rather by sending some XML (which the Asset Map sends) to move an asset from one location to another static location.

The only real problem with this solution at the moment, is that theres no tangible way to couple both the DB Source and the Asset Listing. <_<

[quote]I have an implementation with the Link Manager as well, however I would still need to "Unlink" an Asset from its current location (where the user clicked the delete from originally). Hence why I opted for the "Move" idea.


Is there any way to "Unlink" an Asset from a Root node using the Link Manager? I can't see any option that allows me to do this.[/quote]

Existing links will be shown as checked items in the checkbox list, assuming the dynamic locations are pointed to the correct part of the tree.



Moving an asset using the Link Manager Page would involve targeting the intended destination first and "checking" the appropriate asset in the form submission.

Then assuming everything is fine (ie; the form returns with a checked item against the destination), then Link Manager can be called again to remove the check mark from the previous parent and submit this form.

[quote]Existing links will be shown as checked items in the checkbox list, assuming the dynamic locations are pointed to the correct part of the tree.


Moving an asset using the Link Manager Page would involve targeting the intended destination first and "checking" the appropriate asset in the form submission.

Then assuming everything is fine (ie; the form returns with a checked item against the destination), then Link Manager can be called again to remove the check mark from the previous parent and submit this form.[/quote]





Ah yep, I've reconfigured the Link manager a bit as you said and it shows me the selected nodes that the asset is linked under.



This should be sufficient to get the job done (hopefully).



I'll post a snippet of the JS once its done if anyone is interested.



Thanks for your help guys.

[quote]Ah yep, I've reconfigured the Link manager a bit as you said and it shows me the selected nodes that the asset is linked under.


This should be sufficient to get the job done (hopefully).



I'll post a snippet of the JS once its done if anyone is interested.



Thanks for your help guys.[/quote]

Glad to hear that we could help.



We're always interested in how Matrix is being used - these forums have demonstrated many varied implementations :slight_smile:

Please feel free to share any tips or code snippets so we can learn from your experience.