I’m having trouble with apps that use nested “split at” components to parse data from a text file or html. Here is a simple example to demonstrate the point:
Thank you both (Italo and Anke) for your prompt replies. You both question what the desired result for this program is. This program is only an example that illustrates an issue. I appreciated the suggestions for alternative approaches, but I’d really like to know why the blocks I show don’t work. By “don’t work” I mean the following:
Split_1 button will correctly split an example text string (“abc…xyz”) at the letter “m” and display the expected chosen fragment (“nopqrstuvwxyz”) and fragment length (13).
Split_2 button also correctly splits the above-mentioned fragment at the letter “t” and displays the resulting chosen fragment (“uvwxyz”) and length (6).
However, Split_3 button results in no new displays. It seems to do nothing. The other two buttons remain functional and continue to display as described above, but Split_3 does nothing.
Interesting that it works for you but not me! Could it have to do with the version of Android I’m using (4.2.2)? What possible layout/formatting issues could give rise to the behaviour I observe?
Anke and ABG: Thanks for your input. Here’s what I observe:
Anke’s simple approach WORKS FINE on my tablet when I use AI Companion (thanks!)
My original version STILL FAILS on my tablet when I use AI Companion.
My original version WORKS FINE when I create an apk and install on my tablet!?! (Does that address your suggestion ABG?)
Prospecting (with “Do It” and Enable/Disable) indicates the problem lies with the “Length” block for Split_3_btn (returns nothing – “Length” block for the other buttons return expected value upon “Do It” interrogation).
I would very much like to understand this – there MUST be some learning here! Any clues?
If your Companion falls behind the current version of the AI2 server, weird things can happen at run time with the stack. Double check that you are up to date.
or try to use Companion version 2.57bu and / or remove the folder AppInventor (Internal Storage > AppInventor) from your device before connecting to Companion and try again.
Neither the “clean” version (othernestedsplits.aia) from TIMAI2 or the latest suggestion from Anke work. Same problem with button 3. “Do It” returns 0 for the “Length” block in Anke’s code.
ABG – are you asking how I know the version number of the AI Companion I’m using? If so, it is indicated on the app itself when I open it. Also, no other AI2 spin off used previously.
Anke – I’ll try your suggestion about deleting the AppInventor folder…
Another observation – tried the program on another Android device (ZTE phone). Same behaviour as with the ASUS Tablet – Buttons 1 and 2 work fine, Button 3 fails.