ID |
Date |
Icon |
Author |
Author Email |
Category |
OS |
ELOG Version |
Subject |
69329
|
Wed Mar 24 18:02:07 2021 |
| Sebastian Schenk | sebastian.schenk@physik.uni-halle.de | Question | Linux | 3.14 | Re: automatically obtain entry ID from search | Hi Chris,
Additional the the HTTP request sugested by Stefan you could also use the search functionality of the elog python module.
For the HTTP request you may also need a way to provide credentials or transmit cookies, if the elog needs authentification.
I think your request to alter the samples logbook will be called with "execute new" or similar at submit time of the entry to the measurement logbook.
Then both methods will have the issue that elogd is still processing the submit and can't answer new requests until the old is finished.
Have a look at https://elog.psi.ch/elogs/Forum/69328 for possible workarounds.
Best wishes,
Sebastian
Stefan Ritt wrote: |
You would have to do that on the scrip level. Use "curl" to search a logbook. Like following URL would search for all entries in this forum where you are the authoer, then return the entries in CSV format:
https://elog.psi.ch/elogs/Forum/?mode=CSV1&Author=k%F6rner
Then you can parese this CSV file and extract the entry ID, which you can pass to the elog client to submit a new entry to the other logbook.
Stefan
Chris Körner wrote: |
Hi,
in our application I want to have, let's say in the simplest case, two logbooks. One as a database of samples we fabricated and one as a logbook for measurements. When a measurement on a sample is done and an entry is submitted to the 2nd logbook, I want to automatically edit or reply to the corresponding entry in the 1st logbook. For example I want to append a line in the free text field to have a full log of what happened to a sample there. We reference our samples with a unique auto-generated ID in both logbooks. Is is somehow possible to search the 1st logbook for that ID or any other attribute and obtain the elog entry ID since the elog client will need that ID for editing an entry?
|
|
|
69328
|
Wed Mar 24 17:36:15 2021 |
| Sebastian Schenk | sebastian.schenk@physik.uni-halle.de | Question | Linux | 3.1.3-1-1 | Re: Pre-fill Attribute with last entry | Sorry Stefan, but it is possible as you have the scripting ability.
The idea is to use "Preset Test_Attribute = $shell(script_to_get_the_last_entry)", where the script asks elog about the details and parses them.
The problem here is, that the elogd already is working to resolve the click on "new entry" request (or similar) and the script can't call elogd until the page is delievered, what is to late.
(If it would, the elogd will hang.)
So the script either has to directly parse all the entry.log files in the logbook folder or you need a second elogd running, which can answer the request from the script.
This second elogd could run on a different port and it doen't need to be public as it only answers internal requests and could use the same config as the "primary" elogd.
My idea for the script uses the python elog module to establish the connection and do the parsing.
I hope this helps as a workaround.
Best wishes,
Sebastian
Stefan Ritt wrote: |
Nope, there is no way to acces the last value of an attribute. Sorry.
Stefan
Dominic Schneider wrote: |
Hi all together,
I struggle a lot with the following problem:
I try to prefill certain attributes with the value of exactly the same attribute in the last entry made in the same logbook.
I know I have to go with Preset, tried a view hours and searched the forum but i didn't find a thing. Am I overlooking a flag, an option or whatever, or is there just not such a functionality (which I dont believe)?
I thought about:
Preset Test_Attribute = $Test_attribute
Preset Test_Attribute = Re:$Test_attribute
Preset Test_Attribute = $shell(Command to somehow get last entry and this attributes value)
Not succesful though.
I would be very thankful for help, thanks in advance.
|
|
|
69327
|
Wed Mar 24 16:25:36 2021 |
| Stefan Ritt | stefan.ritt@psi.ch | Question | Linux | 3.1.3-1-1 | Re: Pre-fill Attribute with last entry | Nope, there is no way to acces the last value of an attribute. Sorry.
Stefan
Dominic Schneider wrote: |
Hi all together,
I struggle a lot with the following problem:
I try to prefill certain attributes with the value of exactly the same attribute in the last entry made in the same logbook.
I know I have to go with Preset, tried a view hours and searched the forum but i didn't find a thing. Am I overlooking a flag, an option or whatever, or is there just not such a functionality (which I dont believe)?
I thought about:
Preset Test_Attribute = $Test_attribute
Preset Test_Attribute = Re:$Test_attribute
Preset Test_Attribute = $shell(Command to somehow get last entry and this attributes value)
Not succesful though.
I would be very thankful for help, thanks in advance.
|
|
69326
|
Wed Mar 24 16:20:37 2021 |
| Dominic Schneider | dschneider@mein.gmx | Question | Linux | 3.1.3-1-1 | Pre-fill Attribute with last entry | Hi all together,
I struggle a lot with the following problem:
I try to prefill certain attributes with the value of exactly the same attribute in the last entry made in the same logbook.
I know I have to go with Preset, tried a view hours and searched the forum but i didn't find a thing. Am I overlooking a flag, an option or whatever, or is there just not such a functionality (which I dont believe)?
I thought about:
Preset Test_Attribute = $Test_attribute
Preset Test_Attribute = Re:$Test_attribute
Preset Test_Attribute = $shell(Command to somehow get last entry and this attributes value)
Not succesful though.
I would be very thankful for help, thanks in advance. |
Draft
|
Wed Mar 24 16:11:04 2021 |
| Dominic Schneider | dschneider@mein.gmx | Question | Linux | 3.1.3-1-1 | Pre-fill | Hi all together,
I struggle a lot with the following problem:
I try to prefill certain attributes with the value of exactly the same attribute in the last entry made in the same logbook.
I know I have to go with Preset, tried a view hours and searched the forum but i didn't find a thing. Am I overlooking a flag, an option or whatever, or is there just not such a functionality (which I dont believe)?
I thought about:
Preset Test_Attribute = $Test_attribute
Preset Test_Attribute = Re:$Test_attribute
Preset Test_Attribute = $shell(Command to somehow get last entry and this attributes value)
Not succesful though.
I would be very thankful for help, thanks in advance. |
69324
|
Wed Mar 24 10:06:26 2021 |
| Stefan Ritt | stefan.ritt@psi.ch | Request | Linux | All | V3.1.4 | Re: Request: make $text available for "subst" | Sure, attributes can be shown multi-line, but they cannot be stored in the elog internal database. The database is a very old design and only allows for single line attributes. Just look at a YYMMDDa.log file and you will see that. I would have to change the database format to somethign more advanced like XML, but that would take me a couple of weeks or months.
Soooorrryy! ;-)
Andreas Luedeke wrote: |
While the input widget of text attributes is a single line, they can easily be multi-line in the display - when you use HTML at least.
And of course the user can parse the text field and generate a single line, if he wants to.
If you leave it to me, I'll create wonderful applications to that feature :-)
Please? ;-)
Stefan Ritt wrote: |
$text is the full body text and can go over many lines. Since attributes are restricted to single lines, it's not possible to substitute them with the body text.
Stefan
Andreas Luedeke wrote: |
Hi Stefan,
I've just tried to read the $text with subst into another field and failed.
It looks like $text is only available for the execution of shell scripts in the "execute new|edit|delete = <script>" command.
Could that be added? I can think of a multitude of applications:
- In my case I want to fill an attribute X either with free text or generated from other fields. The list view will show just X and not how it was generated.
- I could fill an attribute automatically with the character length of the text.
- I could parse the text in a shell script and set other attributes according to the content.
Thank you for considering it.
Cheers, Andreas
|
|
|
|
69323
|
Wed Mar 24 10:01:34 2021 |
| Stefan Ritt | stefan.ritt@psi.ch | Question | Linux | 3.14 | Re: automatically obtain entry ID from search | You would have to do that on the scrip level. Use "curl" to search a logbook. Like following URL would search for all entries in this forum where you are the authoer, then return the entries in CSV format:
https://elog.psi.ch/elogs/Forum/?mode=CSV1&Author=k%F6rner
Then you can parese this CSV file and extract the entry ID, which you can pass to the elog client to submit a new entry to the other logbook.
Stefan
Chris Körner wrote: |
Hi,
in our application I want to have, let's say in the simplest case, two logbooks. One as a database of samples we fabricated and one as a logbook for measurements. When a measurement on a sample is done and an entry is submitted to the 2nd logbook, I want to automatically edit or reply to the corresponding entry in the 1st logbook. For example I want to append a line in the free text field to have a full log of what happened to a sample there. We reference our samples with a unique auto-generated ID in both logbooks. Is is somehow possible to search the 1st logbook for that ID or any other attribute and obtain the elog entry ID since the elog client will need that ID for editing an entry?
|
|
69322
|
Tue Mar 23 23:05:20 2021 |
| Chris Körner | chris.koerner@physik.uni-halle.de | Question | Linux | 3.14 | automatically obtain entry ID from search | Hi,
in our application I want to have, let's say in the simplest case, two logbooks. One as a database of samples we fabricated and one as a logbook for measurements. When a measurement on a sample is done and an entry is submitted to the 2nd logbook, I want to automatically edit or reply to the corresponding entry in the 1st logbook. For example I want to append a line in the free text field to have a full log of what happened to a sample there. We reference our samples with a unique auto-generated ID in both logbooks. Is is somehow possible to search the 1st logbook for that ID or any other attribute and obtain the elog entry ID since the elog client will need that ID for editing an entry? |
|