Set Separate Field Text Color Based on Boolean

75 views
Skip to first unread message

Randy Flinn

unread,
Sep 6, 2025, 3:56:07 PMSep 6
to mementodatabase, Vasily from Memento
In the iOS version, I have a text field that I would like to set as red or green based on the result from a Boolean field.  Is that possible?

Randy Flinn

unread,
Sep 7, 2025, 12:50:21 AMSep 7
to mementodatabase, Vasily from Memento
I am very new to JavaScript.  I was trying to create a JS field that would combine two fields into a specific format based on the quantity in one of the fields.

Essentially, if the Qty field >0, then…

Contents of field(“Item”) would join with the field(“Qty”) value.  Assume field (“Item”) = Tires and Qty = 4

Tires - (4)

If field (“Item”) = Tires and Qty = 0

Tires


if (field(“Qty”)>0,field(“Item”) + ‘ - (‘ + field(“Qty”) + ‘)’,field(“Item”))

David Gilmore

unread,
Sep 7, 2025, 11:22:00 AMSep 7
to mementodatabase
You really should create seperate threads if your questions are unrelated.

Question A:

Create a Javascript field with the following code (Assume the boolean field is named "Comnplete"):

if (field("Complete")) "#00FF00"
else "#FF0000"

You will notice the syntax of a Javascript field is a little different from other Javascript syntax.

Then set the background or foreground color (in the library settings) to that Javascript field, depending on your needs.

Bill Crews

unread,
Sep 7, 2025, 11:48:24 AMSep 7
to David Gilmore, mementodatabase
I understand neither Randy's question not James's reply. 

The direct reply would be to use...

If you just want the result Tires - 4, then...

if (field("Qty") > 0)
    field("Item") + " - " + field("Qty");

JavaScript sees that the string values indicate a string type of + and concatenates them with the stringified version of the quantity. 

 Use...

if (field("Qty") > 0) {
    field("Item") + " - " + field("Qty");

In another JavaScript field, you could have total price, if you want...

if (field"(Qty") > 0)
    field("Qty") * field("Price");



--
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 visit https://groups.google.com/d/msgid/mementodatabase/480d4454-9cfb-4eef-8a29-e85517f7e072n%40googlegroups.com.

Randy Flinn

unread,
Sep 14, 2025, 11:16:18 AMSep 14
to mementodatabase
Hello,

Has anyone had success using “libByName” in the iOS version of Memento DB?  In the iOS version I am attempting to open a Library from within another Library.  Specifically, I want to open a Library of Trips associated with a Vehicle from a separate Library.

I can do this in the Android version.

Bill Crews

unread,
Sep 14, 2025, 1:10:36 PMSep 14
to Randy Flinn, mementodatabase
I dunno, but if Vehicles were linked (link to entry field) to Trips, you likely wouldn't have to depend on that. 


--
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.

Er Mo

unread,
Sep 14, 2025, 2:08:37 PMSep 14
to mementodatabase
hallo
Hast du der Bibliothek die Berechtigungen für das Bearbeiten der Bibliothek erteilt

Hello
Have you granted the library permissions to edit the library?

Ernst
Reply all
Reply to author
Forward
0 new messages