LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   I need an id or date column in LOCalc (https://www.linuxquestions.org/questions/linux-software-2/i-need-an-id-or-date-column-in-localc-4175596128/)

littlejoe5 12-25-2016 11:03 PM

I need an id or date column in LOCalc
 
I need a way to pin a unique id to every line in a LibreOfficeCalc sheet. A simple date file (yyyy_mm_dd) or a four place number (or,better, both) would be ideal, but it needs to stick with the data in the line it is in even through sorting procedures, or when a new line is added. And it should be added automatically when a line is added. And it would help if it could change when any cell in the line is changed.

I have searched the internet for an answer, and find nothing that I can understand, or even that I can be sure applies to the problem.

Turbocapitalist 12-26-2016 03:03 AM

One way to get a unique number that changes when the line changes would be to do a hash of the line, MD5 or SHA256 or something. However, LibreOffice won't have a built-in hashing function until the underlying storage format (ODF 1.2) specifies it in the standard. It won't hurt to request it in the LibreOffice bug tracker or to add your use-case there if there is already a bug filed.

Here and how, the way to do a hash looks to be writing a macro. I haven't needed macros since the 1990's so I can't do much more than say it's possible to write LibreOffice macros in Java, Python, or Javascript. You'll have to find a tutorial on that.

Depending on how you do your macro, you might want an IF() combined with an ISBLANK() to check if an important column is filled and only then show your counter.

littlejoe5 12-26-2016 09:26 PM

Thanks, Turboapitalist. I sort of thought of that, but had no idea how to do it, or search for it. Now, I can perhaps use your terminology to at least check it out. (By the way I love your moniker).


All times are GMT -5. The time now is 12:26 PM.