Create a list of all fields in a database (JavaScript)

133 views
Skip to first unread message

Tim Ashby

unread,
Jun 22, 2019, 1:19:22 PM6/22/19
to mementodatabase
I'm looking for a way to examine a library and get a list / array of all the fields in it. I periodically add fields to my main database, and I want to write a script to automatically create an entry in a second database for each field.

Possibly another way to rephrase the question is: how do I convert an undefined object into an array?

In an action:

var libStock = libByName("Stock");
var entries = libStock.entries();
var entry = entries[0];

This runs fine. However:

message(entry.type);

Shows "undefined"

for(var iCount in entry){
message(iCount);
};

Shows "0"

Various other object to array functions also do not work. Any suggestions? Please and thank you :-)

Reply all
Reply to author
Forward
0 new messages