Loading ...
Sorry, an error occurred while loading the content.
 

dynamic wizards?

Expand Messages
  • sgilbert92
    Hi all, Is there a way to customize which fields a wizard shows, depending on other vars in the clip? E.g. something like: ^!Set %foo%=^?{(T=L)First list};
    Message 1 of 4 , Mar 25, 2005
      Hi all,

      Is there a way to customize which fields a wizard shows, depending on
      other vars in the clip? E.g. something like:

      ^!Set %foo%=^?{(T=L)First list};
      ^!If ^%myvar%=1 ^!Set %bar%=^?{(T=L)Second list}

      I thought also of building up the entire wizard string first,
      depending on the variables, but then I wasn't sure if I'd be able to
      pull off "escaping" the ^? parts until I wanted them at the end.

      Stephen
    • Alan C
      ... (unless I ve overcomplicated things ). Like mechanical clock work, off it/we goes -- I developed some psuedo code along with snippets of real code here
      Message 2 of 4 , Mar 26, 2005
        sgilbert92 wrote:

        >
        >Hi all,
        >
        >Is there a way to customize which fields a wizard shows, depending on
        >other vars in the clip? E.g. something like:
        >
        >^!Set %foo%=^?{(T=L)First list};
        > ^!If ^%myvar%=1 ^!Set %bar%=^?{(T=L)Second list}
        >
        >I thought also of building up the entire wizard string first,
        >depending on the variables
        >
        (unless I've overcomplicated things <g>). Like mechanical clock work,
        off it/we goes -- I developed some psuedo code along with snippets of
        real code here and there -- an algorithm, bit by bit, inch by inch,
        arose from that.

        Nonetheless it could be done this way:

        You could do that using ^!Append

        the reason is that Append only builds a list it will not pop up a wizard
        like Set does

        once list is built then can use Set on that and up pops the wizard. I
        learned that from Wayne V. who not been much active lately on the list
        though jumps in once in a great while.

        how U would get say 6 of 9 possible items appended and do the correct 6
        and leave behind the correct 3 items is what I'm wondering about now.

        I don't think an Append will follow an If like Set can do. But I'm not
        certain of that (I'll leave that up to U and others whether it's worth
        trying or not -- but, however I already *do* have it algorithm below
        using Set to build semi colon delimited list then set list into array
        then via loop, iterate that array, from the loop - send it to
        look_up_table to receive each Append action that's needed).

        Perhaps:
        You'd need to check your variables first

        you'd need some sort of an unique association for each variable for of
        all or the total possibilites

        ; also notice the Setarray and the goto ^%wiz^idx%% in loop and how it relays off of this/these
        ^!If ^%myvar%=1 ^!Set %bar%=2
        ^!If ^%myvar2%=1 ^!Set %bar%=^%bar%;3
        ; notice that we're bulding a semi colon delimited list here (using set is ok)
        ; it be the list yes (so can setarray this list then iterate it)

        check and associate (I think) (like above there, yes the list it be the
        list works) so that once you then sent it into a loop to ultimately
        append (no association directly -- but assoc happens when send an item
        to look_up_table -- a specific label in look_up_table is associated with
        a certain append action -- in there the lookup_table, each label differs
        from the other labels and so does each corresponding append action which
        these also be corelated to a list item from the earlier built semi colon
        delimited list

        during loop, use incrementer, send it to look_up_table

        prior to loop, set list %bar% into an array
        Setarray %wiz%=^%bar%


        ; walk (iterate) the array items one at a time
        Set %idx%=1
        :loop
        ; 1st loop goes to (1st item in list's label) (in lookup table) does the
        task there, returns here to loop
        ^!Goto ^%wiz^idx%%
        :loop_div1
        ^!inc %idx%
        ^!If incrementation max has been reached Goto post_wiz_list
        ^!Goto loop


        ; so called look_up_table stuff is below
        :1
        ^!Append item1 stuff here
        (^!Append %wiz_list%="^?{(T=L)First list}; ")
        ^!Goto right back 2 where left off in loop
        (Goto loop_div1)
        :2
        ditto to 1 except 2's stuff here
        (^!Append %wiz_list%="^?{(T=L)2nd list}; ")
        go back as in 1
        :3
        ditto to 1 except 3's stuff here
        go back as in 1

        :post_wiz_list
        ^!Set (wiz has been built, now pop up the wizard)
        ^!Set ^%wiz_list%
        ^!ClearVariable %wiz_list%
        ; whenever use Append, don't forget to clear its variable
        ; more clip code here after wizard pops up
        ; end of clip somewhere further below down in here

        Alan.
      • Alan C.
        ... [ snip howto using walk an array, send to label(s) (look up table) ] Well, later it donned on me that there s a less complex how to do it (without building
        Message 3 of 4 , Mar 26, 2005
          On Sat, 26 Mar 2005 03:19:08 -0800, Alan C wrote:
          >
          > sgilbert92 wrote:
          >
          >>
          >>Hi all,
          >>
          >>Is there a way to customize which fields a wizard shows, depending on
          >>other vars in the clip? E.g. something like:
          >>
          >>^!Set %foo%=^?{(T=L)First list};
          >>    ^!If ^%myvar%=1 ^!Set %bar%=^?{(T=L)Second list}
          >>
          >>I thought also of building up the entire wizard string first,
          >>depending on the variables
          >>
          [ snip howto using walk an array, send to label(s) (look up table) ]

          Well, later it donned on me that there's a less complex how to do it (without building list, without array) -- much easier, right? Here it is:

          ;^!Set %method%=if_method
          ^!Set %method%=next
          ^!Set %myvar2%=plus2; %myvar4%=plus4
          ^!Goto ^%method%
          ; next resumes here. if_method resumes below
          ; at if_method label

          ^!IfSame "^%myvar1%" "plus1" next else skip
          ^!Append %wiz_list%="^?{(T=L)First list}; "
          ^!IfSame "^%myvar2%" "plus2" next else skip
          ^!Append %wiz_list%="^?{(T=L)2nd list}; "
          ^!IfSame "^%myvar3%" "plus3" next else skip
          ^!Append %wiz_list%="^?{(T=L)3rd list}; "
          ^!IfSame "^%myvar4%" "plus4" next else skip
          ^!Append %wiz_list%="^?{(T=L)4th list}; "
          ^!Goto publish
          :if_method

          ^!If ^%myvar1%=plus1 next else skip
          ^!Append %wiz_list%="^?{(T=L)First list}; "
          ^!If ^%myvar2%=plus2 next else skip
          ^!Append %wiz_list%="^?{(T=L)2nd list}; "
          ^!If ^%myvar3%=plus3 next else skip
          ^!Append %wiz_list%="^?{(T=L)3rd list}; "
          ^!If ^%myvar4%=plus4 next else skip
          ^!Append %wiz_list%="^?{(T=L)4th list}; "

          :publish
          ;look in help for StrTrim, StrTrimRight, I don't think StrTrimLeft works here
          ;StrTrim the trailing space here (next line is wrong but not terribly far off)
          ; StrTrimRight(^%wiz_list%;1)$
          ^!Toolbar "new document"
          ^!InsertCode ^%wiz_list%
          ^!ClearVariable %wiz_list%
          ; end clip code

          you can set myvar1 and myvar3
          you can set method differently to see that either If or IfSame can do this same task.

          suggested to avoid setting a variable to zero or one (0 or 1) because they happen also to mean to the parser "true" or "false" -- If and IfSame happen to check for true or false -- so U can get unexpected surprise result when

          ^!Set %myvar%=1
          ^!Set %myvar%=0

          notice that I used plus1, plus2, etc. in code above

          so far I dumped output into a new doc. this is because there is a trailing space on the wizard. wizard likely not work with trailing space at end of the code line. You'll need to use StrTrim to lop off the trailing space -- likely need StrTrimRight but check out the help on the various StrTrim functions

          After that, then can Set the ^%wiz_list% rather than dumping its string into a new doc.

          now if

          ^!If ^%myvar1%=plus1 ^!Append %wiz_list%="^?{(T=L)First list}; "

          happen to work then that take even less code than how I did it above (I don't think its documented for this latter to work though but I'm uncertain)

          Alan.
        • abairheart
          ... on ... I use two methods, both stolen from a friend: 1. When I can input an array: ^!SetListDelimiter | ^!SetArray %current%=whatever ^!SetArray
          Message 4 of 4 , Mar 29, 2005
            --- In ntb-clips@yahoogroups.com, "sgilbert92" <sgilbert92@y...>
            wrote:
            >
            >
            > Hi all,
            >
            > Is there a way to customize which fields a wizard shows, depending
            on
            > other vars in the clip? E.g. something like:
            >
            > ^!Set %foo%=^?{(T=L)First list};
            > ^!If ^%myvar%=1 ^!Set %bar%=^?{(T=L)Second list}
            >

            I use two methods, both stolen from a friend:

            1. When I can input an array:
            ^!SetListDelimiter |
            ^!SetArray %current%=whatever
            ^!SetArray %desired%=^?{(T=A)Prompt for data==^%desired%^%current%}

            which changes the desired array to choices from both desired and
            current arrays (the desired being empty to begin with)

            2. When I must limit the choice to one selection:
            ^!Set %flag%=1
            ;now with whatever logic, you can change the flag value to index
            ;the desired list of options in the next array
            ^!SetListDelimiter ;
            ^!SetArray %choices%=first|list|of|choices;second|list|of|choices;etc
            ^!Set %pick%=^?{(T=L)Prompt==^%choices^%flag%%}

            Note the two different delimiters in the array "choices", a semicolon
            to delimit the array, a vbar "|" to delimi the choices for the wizard.

            Abair
          Your message has been successfully submitted and would be delivered to recipients shortly.