Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [UR] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=23)
-   -   Logical link to another database (https://www.kinook.com/Forum/showthread.php?t=5629)

karelt 12-16-2019 07:56 AM

Logical link to another database
 
Hi!
Love logical linking in UR!
I would like to achieve a logical link to an item in another database now. According to UR help it should be possible.
I have managed to insert a hyperlink into the text of the item, that leads to an item in another db, but I fail to create an item that is a logical link to another item in another db.
May you save me once again, pls?
Many thanks in advance!
Best!
:)
K

kinook 12-16-2019 12:23 PM

Logical links are inherently specific to a single database, but you can create an external link to an item another database.

To create an item in UR that links to an item (source DB) in another database (destination DB), you can:

1) From Windows Explorer, copy and paste the source .urd file with the item to link, and paste into the Data Explorer of the destination DB to create the logically linked item.
2) Ensure that Tools | Options | Miscellaneous | Item command-line format is
Code:

ur://%DB_URL%?item=%ITEM_PATH%&pos=%ANCHOR%
3) In the source DB, select the item to link to and choose Item | https://kinook.com/UltraRecall/Manual/itemmenu.htm]Copy Item Command-Line[/url]
4) In the destination DB, paste into the URL attribute of the item created in step #1
5) To open the link in the source DB, from the Destination DB, select the item and press Ctrl+J or Item | Open Document

karelt 12-16-2019 01:20 PM

Thank you very much for your kind and fast help!
Best regards!
K

Spliff 05-13-2023 02:23 AM

Could you please help me with this? I obviously don't fully understand your explanations above.

I want link from db "0" to a target item in db "y", the target item has the UR path

So, I "copy" the "y" db path (which is d:\ur\y.db) into db "0", and this creates, in "0" a new item, with title "y.db", and with URL "y.db"; in the content pane, there is a link, "Click here to open linked document".

Then, I replace the URL with the target item's path from the UR command-line, and which is (in there) d:\ur\y.db, 9186,1000 (the "id" path being constructed bottom-up, with "1000" as the db tree's source item) - this gives an error message, "System cannot find the file", so I try with \ instead of /, and with file://... before the link, and similar, but to no avail. Thus:

1) What is the exact format for the link in the URL attribute? (My forum search for "URL" didn't bring any result.)

2) Independently of that, would there be a link format, e.g. similar to "file://file_system_path/x.urd/internal_ur_path", which could be used directly from the tree?

3) Similar to 2), but independently of it (i.e. perhaps 3) is possible whilst 2) is not?): Would there be a link format in the form
"c:\ultrarecall_path\ultrarecall.exe" "ur_file_path_and_name/internal_ur_path"
which then could be triggered by a "run" or similar command from the command window or other third-party applications, and which would enable them to open / activate a specific UR db, displaying a specific item?

It's obvious that 3) would be a fantastic tool then for project management (PM) of all sorts, for many possible users who need "real" PM tools, but who want to use UR as an absolutely stable data for masses of data, or even just to have quick access to their data, in UR, from their lightweight "ToDo" / calendar app or similar!


EDIT:

Help in the help subject "Command-line syntax".

You ONLY need the itemID, NOT the internal-path (which had been my error above).

You might create, in AHK e.g., and in order to go from e.g. the "y9186" link item in your current UR db 0.db, to the target item 9186 in your target UR db "y", and understood you would trigger control-enter when the 0.db "y9186" item is selected in the 0.db tree:

$^enter:: ; control-enter
if winactive("ahk")
ur_display()
; else if ...
else
sendevent, ^{enter}
return

Then both the following scriptlets work fine, and our example "y9186" will bring the message-output
_"C:\Program Files\UltraRecall\UltraRecall.exe" "d:\ur\y.db" /item 9186_

This for 1-char UR db names (as mine) only:
ur_display()
{
clipboard := ""
path := ""
item := ""
s := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
path := "d:\ur" . substr(clipboard, pos+1, 1) . ".db"
item := " /item " . substr(clipboard, pos+2)
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s% ; (loads in case, and activates)
}

But since that's not realistic for most users, see (for longer UR db names but not containing digits):
ur_display()
{
clipboard := ""
s := ""
path := ""
item := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
s := substr(clipboard, pos+1)
loop, parse, s
{
if a_loopfield is digit
item .= a_loopfield
else if ( a_loopfield = "." )
continue
else
path .= a_loopfield
}
path := "d:\ur" . path . ".db"
item := " /item " . item
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s% ; as above
}

Now these are for triggering the link from within UR, but it's obvious that you can, with minimal adjustments, trigger any UR item from ANYWHERE, from any possible "app" on your computer; you can also adjust the "TargetfilenameTargetitemnumber" schema according to your liking, e.g. put a leading dot before the naming string, and/or between the name and the number (for that, I added the necessary code to the second scriptlet), or whatever.

Copyright by Spliff in UltraRecall forum, i.e. citations with source in case.


SECOND EDIT:

Well, in practical use now I have to admit that whilst my links work fine, technically, I don't have the slightest idea to what target the lead, hahaha! Thus, let's adopt a link schema as follows (you obviously can then adapt that schema to your liking, it just must be consistent):

.targetdbname.targetitemname (targetitemid)
e.g.: .y.name of the target item (9186)
= last clipboard-element (=item-title): |.y.name of the target item (9186)

then:

ur_display()
{
clipboard := ""
s := ""
path := ""
item := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
if ( substr(clipboard, pos+1, 1) != "." )
{
msgbox, The item is not a link. Aborted.
exit
}
clipboard := substr(clipboard, pos+2) ; without the leading "|."
pos := instr(clipboard, ".") ; first occ (db (!) names without dots only!)
; we delete the divider-dot and then add the suffix-dot, but you
; might use another divider, so this makes sense indeed:
path := "d:\ur" . substr(clipboard, 1, pos-1) . ".db"

pos := instr(clipboard, "(",, 0) ; last occ
item := " /item " . substr(clipboard, pos+1, strlen(item)-1) ; without the trailing ")"
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s%
}

Please note that the "title" part of the link item does not need to be identical with the item title of the target item... and that obviously, you can also automate the creation of the link (by analyzing the clipboard output of the target item (similar to what we did here with the link item), in order to get target db path/name, its original item title, and its ID (while we retrieve those here manually / visually from the Item Attributes field of the target item), not only, as given here, the link follow. Copyright as above.

kinook 05-15-2023 07:07 AM

The Item command-line format must be

ur://%DB_URL%?item=%ITEM_PATH%&pos=%ANCHOR%

I updated the instructions above for that part.


All times are GMT -5. The time now is 09:20 AM.


Copyright © 1999-2023 Kinook Software, Inc.