Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2916 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

 

it's been a while... I'm trying to capture two script parameters by clicking a button. The first parameter is supposed to give me a key for looking up related line items by date, for example the first quarter of 2016, and I also want to capture this as a literal text. The script parameter I've attached to the button looks like this:

 

"1|2016¶

2|2016¶

3|2016¶"

& "1st quarter 2016"

 

The problem is that the second line is interpreted as the second script parameter. How can I express it so that the entire block is interpreted as a single parameter and only the text blurb at the end is interpreted as the second parameter?

 

Thanks,

Stefan

Posted (edited)

I don't understand your question. There is only one script parameter. If your button is defined as shown, then the parameter contains 4 return-separated values:

1|2016
  2|2016
  3|2016
1st quarter 2016

If you want your parameter to contain two (or more) separate parts, where each part can have multiple components of its own, you cannot use the same separator for both tasks. Of course, in the given example you can easily extract the first part by =

LeftValues ( Get ( ScriptParameter ) ; 3 )

and the second part by =

GetValue ( Get ( ScriptParameter ) ; 4 )

---

BTW, if you have a button with the year 2016 hard-coded into its definition, then you're doing something wrong. Surely you don't intend to redefine the button every year?

Note also that if you pass the selected quarter as the parameter - with or without the year - you can have the script calculate the months included in the selected quarter, as well as its text representation. For example, if the selected quarter is in the current year, the button only needs to pass one of the values "1", "2", "3" or "4".

Edited by comment
Posted (edited)
On 25/11/2016 at 10:15 PM, comment said:

>>I don't understand your question. There is only one script parameter. If your button is defined as shown, then the parameter contains 4 return-separated values:<<

I see - I thought that the '&' character would somehow separate the parameters. So actually, the & was transparent then as far as the parameter is concerned. Fair enough.

>>If you want your parameter to contain two (or more) separate parts, where each part can have multiple components of its own, you cannot use the same separator for both tasks. Of course, in the given example you can easily extract the first part by =


LeftValues ( Get ( ScriptParameter ) ; 3 )

and the second part by =


GetValue ( Get ( ScriptParameter ) ; 4 )

<<

That will do, I'm sure. I'll try this.

>>BTW, if you have a button with the year 2016 hard-coded into its definition, then you're doing something wrong. Surely you don't intend to redefine the button every year?<<

Of course, 2016 isn't hard coded - just removing the irrelevant stuff from my question.

Thanks,

Stefan

1 minute ago, stefangs said:

Thanks,

Stefan

PS, sorry about the bad formatting in my response, don't see how to quote and preview around here any longer... and where's that blush emoticon anyway.

Edited by stefangs
Posted

It’s not that hard.

Just select the text you want to quote and a popup will show this “Quote This"

18 minutes ago, stefangs said:

PS

Or

Select the “” in the format header, and paste the text to be quoted in it. The main difference is, the first method shows who you are quoting and the second on is generic.

Quote

the second on is generic.

 

It takes getting used to. :(

Lee

Posted
7 hours ago, stefangs said:

I thought that the '&' character would somehow separate the parameters.

No the & operator joins ("concatenates", in technical terms) two text strings without leaving any trace: "abc" & "de" is exactly the same thing as "abcde".

 

7 hours ago, stefangs said:

Of course, 2016 isn't hard coded - just removing the irrelevant stuff from my question.

I would still prefer to keep the parameter simple and have the logic within the script, where you can see it.

Note also that the calculation as posted will insert spaces after the carriage returns, causing a mismatch in case you are using a relationship for the lookup.

 

Posted
On 27/11/2016 at 5:41 AM, comment said:

No the & operator joins ("concatenates", in technical terms) two text strings without leaving any trace: "abc" & "de" is exactly the same thing as "abcde".

 

I would still prefer to keep the parameter simple and have the logic within the script, where you can see it.

Note also that the calculation as posted will insert spaces after the carriage returns, causing a mismatch in case you are using a relationship for the lookup.

 

Not that I haven't successfully used the & operator for the last 20 years. Don't know what I had been thinking (or drinking) when I posted that...

But:

LeftValues ( Get ( ScriptParameter ) ; 3 )

and the second part by =

GetValue ( Get ( ScriptParameter ) ; 4 )

worked just fine and I would not have figured this out by myself. Thank you for your help and sorry for the late reply.

This topic is 2916 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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