Delaying in receiving data from server

main issue now is, how to split the return string value (the 3 questions) into 3 separate questions, without extra unwanted symbol.

Using the array to capture each question seems like not working. As we can see from result, it select the 1st, 2nd, 3rd character of the 1st question.

To achieve this, the split function will work. Ask you can see in my above posts, you can set the break points for splitting.

But without being aware of what the actual value is, I cannot help you.

Hi,

This is the example of the return string.

[[‘What is the amount of specific heat capacity required to raise the temperature of a metal tube with mass 0.3 kg from 19 oC to 46 oC, by using an electric heater with a power of 46 W for 100 s?’, ‘A metal detector with mass 0.43 kg is heated by an electric heater with a power of 37 W for 86 s. The temperature of the metal detector increases from 19 oC to 42 oC. Calculate the specific heat capacity of the metal detector?’, ‘What is the amount of specific heat capacity required to raise the temperature of a metal tube with mass 0.54 kg from 18 oC to 43 oC, by using an electric heater with a power of 38 W for 94 s?’]]

I need to split it and display in the respective text_area.

text_area 1: What is the amount of specific heat capacity required to raise the temperature of a metal tube with mass 0.3 kg from 19 oC to 46 oC, by using an electric heater with a power of 46 W for 100 s?

text_area 2: A metal detector with mass 0.43 kg is heated by an electric heater with a power of 37 W for 86 s. The temperature of the metal detector increases from 19 oC to 42 oC. Calculate the specific heat capacity of the metal detector?

text_area 3: What is the amount of specific heat capacity required to raise the temperature of a metal tube with mass 0.54 kg from 18 oC to 43 oC, by using an electric heater with a power of 38 W for 94 s?

Please help. Tq.

Okay i can see what is going on now. This is how you can solve this

preds_data=anvil.server.call(‘predictABC’,param_text)[0]
self.text_area_1.text=preds_data[0]
self.text_area_2.text=preds_data[1]
self.text_area_3.text=preds_data[2]
...

Run this code without missing any steps and it should work.

If this does not work. Please do this:

preds_data=eval(anvil.server.call(‘predictABC’,param_text))[0]
self.text_area_1.text=preds_data[0]
self.text_area_2.text=preds_data[1]
self.text_area_3.text=preds_data[2]
...

Hi,

The 2nd code works.
Thank you so much. You make my life easier.
Thanks again.

1 Like