Text change when a value changes

Good day
I am new to this and seeking assistance.
I have two pages A and B on a basic nextion Display.
Page b is a number input similar to a calculator.
If you push say 12 for example, and enter it shows on a text box on page A 12.
In another text box on page A ,I need a lookup that will display the text associated with number 12.
Have about 20 numbers in total.
So 1 equals " books" 2 equals “table” , 12 equals " car" etc…
So when 12 comes up in the text box, the word car should display in the second text box.
I’m guessing an if statement would be the way to go but new to this
Would appreciate any guidance.

There are a few ways to do this but I would use a timer that runs once a second or half second.
In the timer you can put
You can put as many if statements as you want .

It is better to tell us what you want to achieve an over view of the whole thing then the best way to achieve this can be shown

You can use global variables to store the number and the lookup text and/or you can make the input (B) and output (A) text boxes global. Then you can set the values directly.

Hi Elf
Thanks very much for the advice
I am completely new to this Nextion Display and have no idea how and where to do what you suggested.

Thanks Paul
How would I use a timer?
As you suggested.
I ma very new to this.

Basic principal here.

Create a button.
Set Touch Release Event code to:
pageA.t1.txt=“12” // or any other text.

Create another button.
Set Touch Release Event code to: page pageA

Create a text box (currently named t1 in this example.)
Set its vscope to global.
Repeat for second text box.
Create another button.
Set Touch Release Event code to: page pageB

Thanks very much
Will try this evening.
Much appreciated :+1::+1::+1:

Quite straightforward and simple

On pageB add your number box - say n0 (this is where you have your number)
Make n0 global

Back to pageA
Add text box t0 - (make sure ‘txt_maxl’ is high enough for your longest word)
Add text variable va0 with your 20 words each with seperator (make sure variable is String and ‘txt_maxl’ is big enough for total length of string)
eg dog,cat,man,boy,girl, (make sure you end with the chosen seperator)
on pageA in the ‘Preinitialise event’ add following line:

spstr va0.txt,t0.txt,“,”,pageB.n0.val

That’s it - tested and it works - dead easy - 1 number box, 1 text box, 1 variable and 1 instruction

Lets say the n0.val=2 on pageB then when you switch to pageA it will put “man” in t0.txt (note that “dog” is zero)

And if you want to get fancy, you can use EEPROM to store the values :grinning:

Great explanation and details.
Much appreciated Bobj.

Could you use eeprom to store say barcode values for a lookup system?
Do you have any idea how many you could store?
So if your barcode is say , n0 or t0, it shows the item in another box .

How would one structure this type of setup?

As long as they are stored as text, the bytes each barcode will take is the number of characters +1. The EEPROM is 1024 bytes. See “wepo” and “repo” in the Instruction Set.

First posting by LarryG states he has Basic model.
Can you use EEPROM with Basic Nextion?

It seems like “them” are again reading here or was the question posted also elsewhere?

Fjodor - if the ‘them’ refers to me then you’re wrong.
Just trying to help, like you have done for me in the past.

No, you were not meant. “Them” are the Nextion “officials”