You can copy a MyWraps link using the Copy button, and paste it into a MyWraps2() function call in Wrapcreator, with example data for testing.
If you use advanced features in WrapCreator when designing wraps, MyWraps provides a couple of convenient shortcuts.
The Copy button on the toolbar opens a window with two useful resources for the developer.
If you intend to make a call to the MyWraps2 function, you need a MyWraps link. Composing this link manually may be time-consuming and prone to errors. To reduce time and effort, you can experiment with the filter settings in MyWraps until you see exactly the selection of wraps that you would like to have returned by your MyWraps2 function.
After that, you click on the Copy button and two useful fields appear. From the upper field, you can copy the MyWraps parameters that define your current report. You should paste these into your MyWraps2 function call to return the wraps which at that point in time fulfill your current filtering in MyWraps.
The copied link is optimized for clarity. All redundant options are automatically removed, including all settings that will be defaulted anyway, which may make the link much shorter. If you want to include one or more options with their default values, you may of course manually add them back to the link in the MyWraps2 call.
If you just insert text in a column filter, it becomes a co() operation in the copied link. The co and nc operators require extra processing that may make the filter slow when there are many wraps. If possible, use sw, eq or ne instead, or try to limit the number of wraps by adding an eq or ne filter for a different column. This efficient filter will be applied first, and the resource-consuming co or nc operator applied only on the filtered wraps.
When MyWraps detects that a co or nc operation may have to be performed for many wraps, it may recommend that you use eq or ne filters where possible.
The lower field contains test data for your MyWraps2 function. This is the delimited text string that the MyWraps2 function call would return if it were called with the MyWraps link in the upper field of the Copy window right now. In most cases, you should copy the test data into a cell in your wrap and use this cell as the default value for the MyWraps2 function call.
Keep in mind that the data returned by the MyWraps2 function is the dynamic result of a database search and may be different when the MyWraps2 function call is actually executed on live data – new wraps may appear that also match your filters, and currently included wraps may no longer fulfill the filtering criteria in the MyWraps link you have defined.
As you can see in the screenshot, the example string uses the default row separator, a vertical bar or “pipe” symbol, “|” (without the quotes), and the default column separator, a semicolon, “;” (without the quotes).
If your data contains one or both of these characters, you must use other delimiters. The MyWraps2 function call that provides the live data from MyWraps must be set to delimit the returned data using other characters that don’t conflict with the data. If your data contains semicolons, you may elect to instead use the tilde character, “~” (without the quotes), to separate columns. Your MyWraps2 function would then look similar to this:
=MyWraps2(mywraps_link, test_data, "~", "|")
In your wrap, you must specify the actual delimiter returned by MyWraps2 in any TextSplit or similar operation that attempts to parse the live result.
=TextSplit(TextSplit(people_list, "|", 8),"~",2)
The inner TextSplit above would split the data returned by MyWraps2 into rows using the pipe character, and return the eighth row. The outer TextSplit would split this into columns using the tilde as the column separator, and return the second column.
The lower field of the Copy window provides test data that makes it easy to test the above MyWraps2 and TextSplit functions in your wrap. The test data must use the same row and column delimiters that you have set the MyWraps2 call to return, or your wrap will be unable to parse the test data correctly. On the Delimiters row in the Copy window, specify the designated delimiters also for the test data, i.e. “~” as the column delimiter and “|” for the row delimiter. The designated delimiters are automatically inserted into the test data.
Copy the test data and paste it into your wrap for testing. If you paste the test data into a cell called test_data, you can use a MyWraps2 function call similar to this:
=MyWrap2(mywraps_link, test_data, "~", "|")
When testing the wrap in Excel or with Instant Testing, MyWraps is not available and the default data is used instead. When the wrap is uploaded to the server, live data from MyWraps is normally used instead of the default data. Note that the MyWraps function may return the default data also on the server, read more about the results from the MyWraps2 function.