Page 1 of 1
How to put a list into a field on a card
Posted: Tue Jan 28, 2025 9:38 pm
by trags3
I have a .txt file that is a list of items.
I want to put this list into a field on a card when the card is opened and as characters are typed into a search field only items in the .txt file that match are shown.
What I mean is that If the first character I type in is a "P" then only lines beginning with "P" are displayed in the List. Then if I type in an "o" only items beginning with "Po" are displayed.
I know this can be done but I don't know how.
Thanks
Tom
Re: How to put a list into a field on a card
Posted: Wed Jan 29, 2025 9:57 am
by bn
Hi Tom,
Here is a stack that shows one way to do this. It uses the "colorNames" as an example.
It uses a display field "fList" for the filtered list and the whole list is stored as a custom property of that field.
Instead of a custom property you could use any other container to store the complete list that is filtered into the list field.
Kind regards
Bernd
Re: How to put a list into a field on a card
Posted: Wed Jan 29, 2025 12:10 pm
by richmond62
Re: How to put a list into a field on a card
Posted: Wed Jan 29, 2025 1:24 pm
by richmond62
I apologise unreservedly for spelling 'Piccalilli' wrongly:
https://en.wikipedia.org/wiki/Piccalilli
Re: How to put a list into a field on a card
Posted: Wed Jan 29, 2025 1:33 pm
by bn
Hi Richmond,
Thank you for making me aware of Piccalilli.
How about setting the script of field "Sieve" to
Code: Select all
on textChanged
local tWholeText, tfilteredText
put field "fGUFF" into tWholeText
filter lines of tWholeText with the text of me & "*"
put tWholeText into field "fFILTER"
end textChanged
?
Kind regards
Bernd
Re: How to put a list into a field on a card
Posted: Wed Jan 29, 2025 1:56 pm
by richmond62
Super Bernd.
But then I have always been the man who uses a SHOVEL to stir the sugar in his coffee, while you are the man with the refined silver spoon.

Re: How to put a list into a field on a card
Posted: Mon Feb 03, 2025 2:30 am
by trags3
Hi Bernd and Richmond!
I appreciate your help, but I've not been able to make this work quite yet.
The problem I have is I have a text file with About 300 Items. One line per Item.
I need to load that file into a field where the user can then search for a particular
Item. The problem I have Is on fairly rare occasions each user of the app will need to
add one or more items to the list. I have included that ability in the App I have written.
I don't quite understand where the data in Bernd's example comes from, and I
don't want the user to be required to select a file in order to use it in Richmond's
example. I hope this is clear. I have been away from LC for a couple of years and am
a little rusty.
Thanks in advance for your help. I really do appreciate it.
Tom
Re: How to put a list into a field on a card
Posted: Mon Feb 03, 2025 4:30 am
by dunbarx
The problem I have Is on fairly rare occasions each user of the app will need to
add one or more items to the list.
If I understand your last post, assuming the field is locked, simply put this into its script:
Code: Select all
on mouseUp
put the text of me into origText
ask "enter new data"
if it <> "" and the result <> "Cancel" then
put return & it after origText
sort origText
put origText into me
end if
end mouseUp
Craig
Re: How to put a list into a field on a card
Posted: Mon Feb 03, 2025 11:36 am
by bn
Hi Tom,
I tried to adapt my stack to your specs.
It uses 2 fields: one is the complete list of entries that should probably be out of view. That list of entries is used to display the entries or the filtered entries.
I currently use the ColorNames to give the list some 500 entries to work with and see how it responds.
I added the option to add an entry to the complete list.
Clicking on the display list triggers a script for an action when the user clicks at the field, currently it displays the text of the clicked line.
See if it works for you.
Kind regards
Bernd