Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
chriscammers
Partner - Specialist
Partner - Specialist

Trigger Copy Selections to another object

So I have multiple calendars in my data model, Order Date and Ship Date.

I have an Order Tab and a shipments tab.

I would like to use the appropriate calendar dimensions on each tab but I don't want the users to have to reselect date values when they switch between orders and shipments.

So I created variables to store the selections for Year, month and week. then when the sheet loses focus I assign selections to the variables using getfieldselections()

Then when the sheet gets focus it reads the variables and applies the selection to them.

This works perfectly until I select more than one value.

I think there is something missing in the way I am passing the value to the selection but it appears that it may not be possible to pass a list to the make selection action anybody have a tip for me?

Thanks

Chris

7 Replies
Not applicable

Hi Chris,

The attached application allows for the selection of multiple userid's on one tab, stores them in a variable OnLeaving sheet, then creates a selection based on this variable on activated sheet.

You should be able to expand on this to store Year, Month, and Week fields.

The most difficult thing was to figure that the search string used to create the selection in the action for multiple values is "(value1|value2|value3)"

To build the string we use the following code in the "Set Variable" action on the first tab:

='(' & concat(distinct userid, '|', fieldindex('userid', userid)) & ')'


Hopefully this explains what is going on in the qvw. Let me know if you need more details.

-Andy

chriscammers
Partner - Specialist
Partner - Specialist
Author

I knew I just had the wrong syntax for the list, of all the delimiters I never thought of the "|"

Thanks

mikofme
Partner - Contributor
Partner - Contributor

Hi Andy,

the search string using the pipe symbol '|' works fine as long as the selected values don't contain any blanks. Any idea for the syntax to use in that case, e.g. "(value with blank 1|value2|value with blank 3)" ?

Regards,

Miko

Not applicable

In order to include a value that contains a blank, you will need to quote each search string. Building upon the previous example, this would mean that we need to include a single quote inside of a quoted string due to the way we build the string using concat.

To "escape" the single quote, we will use the function chr() function to create a single quote.

='('&chr(39) & concat(distinct userid, chr(39)&'|'&chr(39), fieldindex('userid', userid)) & chr(39)&')'


Hope this helps.

-Andy

mikofme
Partner - Contributor
Partner - Contributor

Hi Andy,

thanks for your idea, but it doesn't work.

Try this to verify: in the given example app (pass_selections_over_tabs.qvw, see above), edit the script as follows:
in line 26, modify "A" to "A A" (just add the characters "blank" and "A")
in line 31, modify "A" to "A A"
in line 31, modify "A" to "A A"

Run the script, select userid "A A" on the "Main" TAB and switch to "Show Variables": the userid is selected, but in the listbox "other_users" it isn't.

Any other idea to manage values containing a "blank"?


Regs,
Miko

Not applicable

Hi Miko,

In your data changes, I think you meant... in line 40, modify "A" to "A A" instead of repeating 31.

In addition to adding the quotes in my last post, you also need to change the OnActivate action which is currently sets other_users to =v_userid, should be changed to use dollar-expansion like this; =$(v_userid)

-Andy

Not applicable

Thanks so much, I have just been struggling with this issue for several hours!