Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Troi Dialog, How to Parse the Result?

Featured Replies

  • Newbies

I have been playing around with the Troi Dialog plug-in, using a 5 field input dialog box.

The result is a string, broken up by |

All of the results will be of different lengths. So, I am getting in a muddle in trying to split the long text into its 5 component pieces.

You can have Troi return each of answers by using the 'GetInput' command.

Steve

  • 3 months later...

Hey;

You can also parse the results quite easily with a few short scripts. Assuming you are using TroiDialog the seperation character is the pipe

symbol ----> | but this procedure can be used to extract results from

any kind of delimited thingy.

Just using TROI as an example, the inputdialog function returns something like this: 1|smallthing|alargerthing|bob

To begin, just add a | to the end of the result with the following:

Set Field: _Gresult = _Gresult &"|"

This will result in the following: 1|smallthing|alargerthing|bob

As you probably know with TROI the first item is the button number pressed. Extract that SetField: _GButtonPress = left(_Gresult,1)

Secondly, to parse the variable length contents from _Gresult and assuming the seperator is the | symbol, use this:

Set Field: Parsed1 =

Middle(_Gresult,

Position(_Gresult,"|",1,1)+1,

Position(_Gresult,"|",1,2)-

Position(_Gresult,"|",1,1)-1)

To get the next value, simply increment the reference to which "|" to look for like this:

Set Field: Parsed2 =

Middle(_Gresult,

Position(_Gresult,"|",1,2)+1,

Position(_Gresult,"|",1,3)-

Position(_Gresult,"|",1,2)-1)

Set Field Parsed3 =

Middle(_Gresult,

Position(_Gresult,"|",1,3)+1,

Position(_Gresult,"|",1,4)-

Position(_Gresult,"|",1,3)-1)

Very simply this script does the following: Set the field of Parsed_whatever to the "Middle Text" between positions 1 and 2 (or 2 and 3 / 3 and 4, etc) It calculates the length of the text by deteriming the positions of the pipe symbols, and subtracting them. Importantly though, the +1 and -1 that you see in the script set the middle text to the desired results WITHOUT including the pipe symbols. If you take out the +1 and -1 then the parsed result would look like: |smallthing| instead of the desired result: smallthing

Now finally, the reason why the first step is to add a "|" to the end of _gresult is so that this script can easily identify the last input. If _Gresult doesn't end with a "|" then it won't work.

Hope this helps smile.gif

Steve

(I've attached a sample file )

Parse.zip

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.