Calculated field using an autofill field from another library

384 views
Skip to first unread message

Diego Marino

unread,
Jun 14, 2018, 6:11:45 AM6/14/18
to mementodatabase
Hi,

i have two libraries

1) people
2) job position

in the library "people" i have and autofill field based on the "job position" library
so in a record of people library, i write on the field "position" and i take values from the "job position" library

every record in job position library has two field: "position" and "contract"

now, when i give a value of a "position" to a people in the library "people" (e.g. recruiting manager), i'd like to have a calculated field that shows the field "contract" (e.g. full contract)

how can i make it?

Diego Marino

unread,
Jun 18, 2018, 8:38:35 AM6/18/18
to mementodatabase
hi, no idea about that?

António Graça

unread,
Jun 20, 2018, 12:22:59 PM6/20/18
to mementodatabase
Hello

I think it is better to work with an "input link field" in table people. From there (job position), with a field calculation it is very easy to extract any information (contact, etc) from the chosen record to the People table.

insert in table People a link field (choose table job position)
insert in table People a claculation field to Position and other to Contact

António Graça

Diego Marino

unread,
Jun 20, 2018, 1:04:09 PM6/20/18
to mementodatabase
thanks antonio, i was writing cause i found the solution

given that i deleted every "input link field" from my libraries cause they slow down as hell the database, it's easy to do what i looked for.

When you create an autofill rule on another library, you can add other rules as well

for example

In "contacts" library i have a field "profession" that has an autofill rule based on the "professions" library. So, when i write in the textbox "profession" i can see every matching results, and i can choose one of it.
then, i added some some other rules, so, when i choose a profession, another field called "kind of contract" is filled with a value took by the library "professions" (e.g. full time)

that works great for me, and i repeat, NO INPUT LINK FIELD, memento is not a good relational database, and my database now is very fast without link to other libraries

btw, really thanks to you

António Graça

unread,
Jun 20, 2018, 7:10:57 PM6/20/18
to mementodatabase
Hi, Diego

If you dont need link to input field, maybe the best options is the autofill with other table.

I have Input Link Field because I need link the Performance with Athlete and clube, and coach, etc.
Plus... If I open the record, in table Performance, I touch in name of Athelte and I open profile of athlete. If I touch in club of athlete, I open the profile of club... and so one to Coach and other options. I have Input Link Field; calculation field and javascript field to achive my goal.

You know. I need open the record (profile) of athlete and access to all information about athlete performance, historical, etc.(I send a pscreen). With autofill option I cannot do this. 

But, I have a big problem. I have about 1100 records in one table (Athlete) and I have about 5000 records in other table (Performance of Athlets), about 250 record in table Club and 180 Coach. Everything is connected. When I open an profil of Coach, I have a list of athles wich training with this coach. When I open an club profil I have a list of athlets registrad in club.

I can made my work. Its fantastic! But, the problem is the speed the table Athlete and table Performance is very slow (1 or 2 minuts to open a list).

I think is not possible to do the same routines with Autofill option to increase the speed of tables.

I cannot options to solve the problem

António Graça

Bill Crews

unread,
Jun 20, 2018, 7:42:53 PM6/20/18
to António Graça, mementodatabase
I should make a wiki page about performance. I think I know the main determinants of performance, at least on Android, but I'm sure there are others I don't know.

If the top of my head, I guess the guidelines would be...

JavaScript & Calculation fields

* Use JavaScript and Calculation fields only as needed. Avoid them when you can.
* Try to run JavaScript field scripts only when edited, which is the default. Scripts that are temporal, returning things like remaining time before taking the next pill or whatever, take a lot of time and if it is set to run in real-time, it takes it every time you do anything, like when it rotates from Portrait to Landscape or when the screenconfess back on.

Memento JavaScript Library scripts (triggers, actions, etc)

* The JavaScript entries() method of the Library object takes a long time to execute. Do it only when you need to.
* Referencing across links takes a while, so if you reference fields in another library and maybe reference a link in another library and use that to reference fields in yet another library, AND if you do that within a loop (as I have done), your script will run a very long time.

Those are the biggies I can think of. Let me know your experience, and I'll document them in a wiki page.

Bill Crews

unread,
Jun 20, 2018, 9:35:19 PM6/20/18
to António Graça, mementodatabase
I should also have said that, as pointed out by another forum member recently, JavaScript field work fairly quickly, but slow down substantially when set to the role of Entry Name, Entry Description, or Entry Status. If the role is Regular Field, it takes much less time.

António Graça

unread,
Jun 21, 2018, 5:18:59 AM6/21/18
to mementodatabase
Hi Bill

Thanks for the clarification about speed with several options.

In fact, as I was developing my library and adding linking routines between tables and fields, I started having my tables slower. It's true, but memento has these potentialities that help me a lot and I try to use it. But I had to stop with some of those routines.
I am a National Athletic Coach and I have tables with the athletes, the athletes' marks, the clubs, the coachs, etc. Everything is connected. Then I have routines that allow me to work with the athlete's birth date and automatically update the athlete's category according to the current date. This is fantastic! There are 1100 athletes, so I do not have to go one by one to change their category as time goes on. So, I need the routine in JS to work in real time. For all this, the library works slow but I have no other way to domy libraries.
But it reached a limit in that, by adding automatisms (auto routines) that help me immensely, the table "bursts", goes below.
I have a table where I introduce the perfromances of athletes (at 1,500m, at 10,000m, marathon, etc.). And, I did a routine that allows me to identify if that time performed by the athlete is Qualification Mark for the Campionship of Europe, or the World, or Olympic Games, according to the data that I introduce. This is fantastic, it avoids mistakes and work. But memento can not handle these routines anymore, and I stop to do news routines.

When memento is working slow, if I clean the memory of the device and the cache it works better. Would not it be a good idea for memento to have a button to optimize memory and cache? (see image in attachment).



Thanks for your hint's

António Graça

Bill Crews

unread,
Jun 21, 2018, 6:19:13 AM6/21/18
to António Graça, mementodatabase
One thing you might consider trying is to replace your real-time JavaScript fields with regular fields updated by a library action or better still, by a library opening trigger.

The problem with real-time JavaScript fields is innate; they run all the time, whether they need to or not.

With a library opening trigger, the script could update the fields when the library is opened, so there will be a delay. However, while it is open, the library will run relatively fast.

If that's too often for you, you could do the update in a library action and do the update when and only when you invoke the action by pressing the Play button in the entries list screen.

--
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.
For more options, visit https://groups.google.com/d/optout.

Diego Marino

unread,
Jun 21, 2018, 8:00:28 AM6/21/18
to mementodatabase
Hi to all, this is a very intereseting topic.

considering i banned linkedin Fields (memento is not access), the Best option is to have a button that open another library, And if possibile search the value Stored in a autofill field.

Do You Think it's possibile bill?

Bill Crews

unread,
Jun 21, 2018, 9:13:34 AM6/21/18
to Diego Marino, mementodatabase
I don't understand what you mean. Maybe you can ask again, but in your language?

Diego Marino

unread,
Jun 21, 2018, 10:15:42 AM6/21/18
to mementodatabase
Sorry bill

i mean:
in my calendar library, i have an autofill text field in which i put my contact (every task has a person linked)
is it possible to have a button o something similar that opens the "contact" library and maybe the contact in the autofill field?

Bill Crews

unread,
Jun 21, 2018, 10:45:08 AM6/21/18
to Diego Marino, mementodatabase
Ah. So, do a link without having a link?

Well, to do it from an entry card, you could create an entry action. Accessing the Contacts library is no problem -- libByName(). You can do a findByKey() to get the Entry object, then a show() to show its entry view card. So, I guess yeah, it's all possible. Of these, I've done only libByName(), so I don't know how cleanly the rest works and how the user gets back to the original library when it's done.

If I understand correctly, the fact that the value of the "Autofill field" was set by Autofill is not really pertinent; its value is its value, however that got set, right?

My experience has been that yes, traversing links in scripts adds to the time of the script significantly, but I have not seen that the user interface shows significant delay in opening an entry across a link, which is what this would emulate. Your level of desperation seems overly large to me; maybe your libraries are much larger than mine? I seldom have thousands of entries, usually just hundreds.

Diego Marino

unread,
Jun 21, 2018, 12:52:48 PM6/21/18
to mementodatabase
thx bill, i'll find out how to make what you wrote, seems a good solution

about linked fields....yes, they are very slow. The problem is that my libreary of contacts is of 7000 entries, and it was linked to more than  7 libraries (companies, deals, contracts, calendar, professions, cities etc)

displaying data was low, expecially when grouping data (more than one or two minutes). RIght now it takes only few seconds.....so i make the choise to eliminate every linked tables, and autofill it's a very good solution

Bill Crews

unread,
Jun 21, 2018, 3:42:01 PM6/21/18
to Diego Marino, mementodatabase
A good lesson for us all. Hopefully, over time, the difference will become smaller and smaller.

--

António Graça

unread,
Jun 21, 2018, 7:44:56 PM6/21/18
to mementodatabase
Hi Bill and Diego

I am trying to understand if it is possible with these procedures to do the same thing I do now. Link all tables.
Please watch the video. Can I have these functions without the Input Link Field and do everything that is in the video?
On the other hand, I'm trying to understand what steps to implement these procedures to "override" the Input Link Field.



António Graça

Diego Marino

unread,
Jun 22, 2018, 5:54:43 AM6/22/18
to mementodatabase
ola antonio,
eu esto buscando um geitinho de fazer o mesmo cum o meu database, talvez podemu trabalha juntos.
assim que eu conseguir um resultado, escrevo aqui

António Graça

unread,
Jun 22, 2018, 6:00:56 AM6/22/18
to mementodatabase
Obrigado, Diaego

Afinal, voce escreve português? é brasileiro?  e eu pensava que fosse espanhol, italiano...

Viu no vídeo como tenho as bibliotecas montadas? Preciso continuar assim, com estas conecções entre tabelas, mas mais rápido. Espero que seja possível um outra forma de fazer, com um resultado mais rápido mas chegado ao mesmo fim.

Diego Marino

unread,
Jun 22, 2018, 6:06:55 AM6/22/18
to mementodatabase
italiano, mas fui em portugal e assim falou um bocadihno de portugues.

viu como vocé fiz o database, agora vou estudar uma solucao para o meu purque è mais fazil para mim, e depois vou escriver a solucao...

espero de buscar uma solucao, em verdade :-D
Message has been deleted

Diego Marino

unread,
Jun 25, 2018, 9:13:59 AM6/25/18
to mementodatabase
Hi bill, i triedd the script. It's surely full of errors-....

var Candidato = entry().field("Candidato");
if (entries.length > 0) {
LibByName(Contatti).findByKey(Candidato)
Show()

Reply all
Reply to author
Forward
0 new messages