consecutive number (i. e. invoice-number, file number, case-number)

74 views
Skip to first unread message

Heiko Lang

unread,
Feb 21, 2021, 4:57:34 AM2/21/21
to mementodatabase
Hi at all!

Does anyone have a workarround to create consecutive numbers in Memento, when I add a record.  

The goal is: user create a new database record with the android app; for this entry we need a unique consecutive number with prefix (i. e. INV-0001, INV-0002, ...).

Thanks & nice Sunday!

Heiko


Bill Crews

unread,
Feb 21, 2021, 5:45:27 AM2/21/21
to Heiko Lang, mementodatabase
2 fields, one on the current MAIN page and the other on another page called something like X or Hidden or <something that'll be ignored by the user>. I generally call my "other" pages Admin, so as to be likely ignored, even though there's probably nothing administrative on that page.

MAIN page
Insert (+) a JavaScript field, called Invoice #, and enter the following tiny script ...

"INV-" + field("#")

Then, insert (+) the new page, and on that page insert an Integer field called #. In the mobile edition, under Default value, select Auto-increment.

You might want to make one of these fields the entry name.

You're done. Memento will increment # for each new invoice, and the Invoice # field will add your prefix on the front of it.

If you can find some other way to hide a Field you don't want users to see, go for it, and please let us know how you did it.

--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/e343dd00-9de4-4e2b-9ad9-42d5a895f82cn%40googlegroups.com.

Heiko Lang

unread,
Feb 21, 2021, 6:43:02 AM2/21/21
to mementodatabase
Hi Bill. 

many thanks, works fine. One other question: is there a possibility to add leading "000" like to generate sonsecutive numbers like this... 0001, 0002, ... 0099, ... 0100, ...?

To hide a field I use two checkboxes with conflicting 'Dependencies of the field' setting. 

  1. add two checkboxes to your database: i. e. invisible1 and invisible2
  2. set at invisible1 the 'dependencies of the field' to 'visibility of the field' and link it to the field "invisble2"  
  3. the same settings vice versa for invisible2
  4. then edit your field which you want to hide change 'Depdendency of the field' to 'invisible1' 
Invisble1 will hide your selected Field. And the contradicting dependencies of invisible1 and invisible2 will hide the two checkboxes. I know, a crazy way. But it works fine with small projects.

Sorry, I hope you can follow my explanations, my english is not the best! 

Er Mo

unread,
Feb 21, 2021, 7:15:32 AM2/21/21
to mementodatabase
Hallo
Ja genau so mache ich das auch . 2 Felder die sich gegenseitig ausblenden und ein Skript mit den ich sie Sichtbar schalte .

Hi
Yes, that's exactly how I do it. 2 fields that hide each other and a script with which I make them visible.
Reply all
Reply to author
Forward
0 new messages