Video Tutorial or Help with If-Then-Else?

User-to-User discussion about the PhraseExpress macro programming.
Post Reply
Hitch
Posts: 3
Joined: 19 Apr 20, 02:46

Video Tutorial or Help with If-Then-Else?

Post by Hitch » 22 May 20, 14:21

Hi:

(n.b.: if there exists a video tutorial, or written, on methods of deploying If-Then-Else, I would love the URL, thanks. I've searched here and around and have found NOTHING, other than "it exists.")

I'm trying to create a series of Phrases that nest, effectively creating a pre-determined Document Generator-type result, so that my employees don't have to choose which "next phrase" they need, but instead, have it piped to the document based on their choices of radio buttons, etc. I'm trying to do this for all our canned/repeated responses and then deploy PEX company-wide. (Not that that's a ton of people, but...hey. We do an obscenely high amount of customer service email for such a teeny company and I'm hoping this will help better manage the load.)

I have created "component" phrases, that are meant to work as these "nested" (if/then) elements. The primary (main or beginning) section has 1-2 manual entry items (customer name), and then a choice for the crewmember. At the moment, I am using radio buttons, but I'm not married to that.

I then store the result as a temp. variable. So far, so good.

But then I stall out. I originally thought it would be as simple as just indicating "if A=1, run this phrase," but obviously, that's not it. Do I need to record macros, running each (to-be-nested) phrase, and insert those in the "then" options, after the ITE calculations? So that if I have, say, 6 options in the radio buttons, I would have 12 macros of 12 phrases? That seems a bit inefficient, but if that's what it takes, so be it.

I feel that I'm missing something obvious, but...I've played around with this for some weeks now, a few minutes here/there (which is about all the extra time I have) and I'm hitting the wall on this. I own a teeny business and I don't have the available time to noodle with this like I'd love to, to delve into all its secrets. Can anyone give me a leg up, a pointer, ANYTHING? The two whole lines of documentation about it in the official documentation aren't very useful. I'm usually pretty good with logic puzzles, but I seem to be air-gapping my brain on this one. ;-) Not in a GOOD way!

Thank you in advance. Sorry for such a basic question.

Peter Stotz
PhraseExpress Expert
Posts: 880
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 25 May 20, 00:02

@Hitch
for certain standard applications, you could specify a sequence of phrase modules with their autotexts as string, e.g.
'#hello #customer_name #Order_Confirmation #signature #company'
'#hello #customer_name #Spare_Parts_Delivery #signature #company'
...
and process these modules automatically one after another in a loop with {#insert <autotext>}

Peter Stotz
Windows 10 - PhraseExpress v15.0.43-beta
Translated with www.DeepL.com/Translator

Hitch
Posts: 3
Joined: 19 Apr 20, 02:46

Post by Hitch » 25 May 20, 19:14

Peter:

I appreciate your time and answer. I guess I'll keep playing with it and see if I can make your suggestions work. Given that there's ZERO documentation--two whole lines of text in the v14 Documentation--I assume that PEX expects us to guess. Or play with it until something works.

Vielen Dank,
Hitch

Peter Stotz
PhraseExpress Expert
Posts: 880
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 25 May 20, 20:47

@Hitch
an old saying of mine: „programming is not for sissies!“ ;-)
„... ZERO documentation ...“ - come on Hitch:
1. PhraseExpress manual see https://www.phraseexpress.com/doc/
2. Internet-help: see on the manual home page the help button top right
3. In addition, user without programming experience are excellently supported by the forms for macro programm creation. The developers have done a great job in v.14. for this - they have my full respect!
4. And you also have the people in the forum - and hi - me ;-)
So here an example of my proposal:
1. Starting phrase

Code: Select all

(* 20200525 • Example: Executing a series of phrases in series
   Phrase execution is controlled by a string containing the autotexts of the phrases to be executed
*)–––––––––––––––––––– begin
{#settemp -name ##string -content <autotext_phrase1> #ENTER <autotext_phrase2> #ENTER <autotext_phrase3> #ENTER #ENTER <autotext_phrase4>}(*
*){#insert *execute_macro_programs}
–––––––––––––––––––– end
Necessary adjustment in the start phrase code:
For <autotext_phrase×> use the respective autotext of your "component" phrases

2. #insert-Subroutine *execute_macro_programs with autotext *execute_macro_programs (required in the start phrase)

Code: Select all

(*20200525 • #insert-Subroutine *execute_macro_programs
  Execute first string element
*){#insert {#trim {#regexget -text {#gettemp ##string}  -expr ^[^\x20]*\x20}}}(*
  Cut the string ##string
*){#settemp -name ##string -content {#trim {#regexrep -text {#gettemp ##string}  -expr ^([^\x20]\*)\x20 -repexpr  }}}(*
  Check: Continue or end?
*){#check -text {#gettemp ##string} -case !=  -output {#insert *execute_macro_programs}}
3. Create a phrase #ENTER with autotext #ENTER and phrase content {#ENTER} to insert additional line breaks

I hope this is helpful for you
Peter
Windows 10 - PhraseExpress v15.0.43-beta
PS: Thanks for your "Vielen Dank!" in German - I noticed it...
Translated with www.DeepL.com/Translator

Hitch
Posts: 3
Joined: 19 Apr 20, 02:46

Post by Hitch » 28 Jun 20, 22:07

okay, so...

This is embarrassing, but the long and short of it is, after months of being stymied (geschwächt, ja?), I realized, abruptly, and accidentally, that I had understood (misunderstood) something in the Documentation. I took the statement literally. It was simple to solve, ONCE I stopped "hearing" it as X.

Duh. So, it's easy to do what I wanted. I just...misunderstood a single line to mean I had to do something that I couldn't identify, couldn't figure out how to do. Once I accidentally did the right thing, with a missed click...it was easy.

So, Peter, Ich möchte mich bedanken. I have it solved now, or at least, I can move forward with it.

Peter Stotz
PhraseExpress Expert
Posts: 880
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 28 Jun 20, 22:23

@ Hitch
Thanks for your feedback.
We can meet again in this forum with pleasure.
Bye so long!
Peter
Windows 10 - PhraseExpress v15.0.52-Beta

Post Reply