MQTT info on request

hello
I would like to read out a mqtt topic and all the paths under it, in that point of function when is needed.
i would like to display an on demand status from the mqtt topic
Unfortunately, mqtt only reads out something when a change takes place and then only the change. Can I somehow start a query to see what the underlying levels look like?

Topic/#
then
Topic/1/a Payload=xx
Topic/1/b Payload=xx
Topic/2/a Payload=xx
Topic/2/b Payload=xx
.......
Topic/11/a Payload=xx
Topic/11/b Payload=xx

That is not how MQTT works. You subscribe to a topic (or topic range) and the broker informs you when something sends a new msg to that topic.

You can have a single subscription that listens to all your topics Topic/# will listen to everything. You can then use switch or function nodes to process things depending on the actual topic.

There is no need to show an on-demand display if you are using something like a web page. But if you want on-demand from something like Telegram, all you need to do is get Node-RED to record the last change from MQTT in a variable then use that.

As already mentiioned, this is how mqtt works and it is different from what you expect.
When you have control of the side that publishes the desired topics, you could instruct the pulisher to do that with the retain flag set. This way, when you subscribe to the topics, the broker will immediately push the new topics & values (to make this behaviour work for every time you (re-)connect, instruct the mqtt-in node to subscribe in a "clean session" and use QoS type 2).

HMM that can't be quite right.
If I redeploy the mqtt in, then the entire topic is read out. So there is a way to do this manually, why shouldn't it be automated?
There are a lot of data sent by different modules under the topick, which I don't want to re-trigger all of them.

If you want to learn more about MQTT then see this tutorial MQTT Essentials - All Core Concepts explained

It’s well worth the time. It will give you an understanding of how MQTT works.

Only if the topic has been published with the Retained flag set.

If you really need this then store what you want in a context variable, then it will be available whenever you need it.

Hello
I have now written all events in a context flow.set(data,msg.payload).
Is there any way to search all the data written like this in this flow for a specific value like NAN.

I don't know the value of "data" as it just reports depending on which machines are on.

I think the best way is to write the data into a database, then I can probably search better and also delete if a machine has not been on for 24 hours.

Several, depending on how you've got that data configured. The easiest is not to search at all but rather use an object key'd on the identifier. If you are using an array, it is a little harder but JavaScript has some very useful array processing functions such as filter.