New to KM and absolutely loving it but I have a very basic question if that's ok.
I'm using user input to create drop down and tick boxes but as the result I get from the tick box is either a 0 or 1, I'd love to be able to select a tick box then that triggers custom text. For instance, when I select the tick box marked Left I'd like it to out put L, for the tick Box Right I'd like it to output R etc
I'm not sure if that's possible, but I want to ask what you want the field to output if it's unchecked... an empty string? I think you're going to need to add a statement after the Prompt to convert the result to the string that you want.
Since the string you want is alphabetic, you'll probably need an IF statement and a Set Variable to String to get the value you want. However if the string you want is numeric, there's actually a sneaky trick you can use called the tertiary operator. but I think strings are the right choice for you.
That's true, but I'm going to use the Append option of Set Variable to Text to fix this. Coming up soon. I'm giddy over my solution. Still working on it.
Let me show you some of the magic I've dreamed up here. This is just a screenshot showing you the technique I'm using (I'm not uploading all the code yet.) Notice that I've created a loop for some of the parameter names. Inside that loop, I use a trick (lots of percent marks) to append the contents of the variable with that name onto a variable called "TheResult". This is working. But it's not finished because I haven't added the code for the L/R parameters yet. And I noticed an ambiguity in the requirements. That is, if the Comments field is empty, do you want a pair of colons, or nothing at all. I may have to modify the code if I made the wrong assumption.
This is a pretty cool technique. I created it because I didn't like the idea of dozens of IF statements.
I'm still working on the code that deals with the L/R. Okay, I think I got that code working. Here's an image, I'll post the macro's code in a moment. Notice how I extract the first letter of the parameter and append it to the output if the value of the parameter is 1 (checked). Pretty cool.
Here's the macro.... I'm pretty sure I made some wrong assumptions about which variables are handled which way. Just move the variable name into the other textbox if I made the wrong assumption. If I've mishandled anything, I can fix the code. I just realized that we probably want to strip the final ":" from TheResult. That would be one more line of code.
Or you can completely ignore my code if you'd rather do it the old fashioned way.