I want to establish lookup table macro depending on content of utm_z cookie.
For example if user have in utm_z cookie specific value (for example abc) my lookup table macro need to return specific value.
I made 1 party cookie variable returning value from utm_z cookie. This variable return for example '125233995.1441192396.4.2.utmcsr=aa|utmccn=cc|utmcmd=aa|utmctr=aaa|utmcct=bb
I can not use regular expresions in Lookup table macro.
It's hard to answer without knowing which value you want to get, but you can use a custom javascript variable to extract the value via regex (e.g. something like .*utmcsr(=.*?)\|.* to get the utmcsr value) from your cookie variable and then pass the the variable with the extracted value to the lookup table.
So the first party cookie variable feeds into the custom javascript variable to extract the value which in turn feeds into the lookup table to return the value you want.
Related
I have a list page with some filter, sort and search functionality (which basically creates a QuerySet in the view that then returns the adjusted (filtered, sorted, searched) data). On this list page, I also have a detail view that displays the object details.
This all works fine, but when I navigate to another detail object, the search, filter, sort parameters get reset to their default.
How can I retain the search parameters beyond a server round trip?
Thanks!
You could store the GET parameters as session variables maybe?
To set:
request.session['my_variable'] = request.GET.get('some_get_parameter')
To get:
my_variable_value = request.session.get('my_variable')
Using .get() to retrieve parameters and session variables is a little more robust than just trying to access the dicts directly with request.session['my_variable'] for example, as if my_variable is not in the session, you'll get a key error, but get() returns None if the variable is not found.
I'm using Postman and wondering if I can use a stored JSON object to create variable for additional calls. For an example: I saved an array which include name and ID:
[{"id":28,"name":"Action"},{"id":12,"name":"Adventure"},
{"id":16,"name":"Animation"},{"id":35,"name":"Comedy"},
{"id":80,"name":"Crime"},{"id":99,"name":"Documentary"},
{"id":18,"name":"Drama"},{"id":10751,"name":"Family"},
{"id":14,"name":"Fantasy"},{"id":36,"name":"History"},
{"id":27,"name":"Horror"},{"id":10402,"name":"Music"},
{"id":9648,"name":"Mystery"},{"id":10749,"name":"Romance"},
{"id":878,"name":"Science Fiction"},{"id":10770,"name":"TV Movie"},
{"id":53,"name":"Thriller"},{"id":10752,"name":"War"},
{"id":37,"name":"Western"}]
I'm triggering another API (second call) that retrieves only IDs, so the response is like this: "genre_ids": [35, 10402]
Is there a way to create an environment variable that looks for the IDs, fetch the relevant name from the second API and create a name oriented variable so on the case above 35=comedy and 10402=music so the variable will be: comedy,music?
to save environment variable you can do the following (see the snippets on the right side of postman):
postman.setEnvironmentVariable("variable_key", "variable_value");
if you want to save a global variable just do :
postman.setGlobalVariable("variable_key", "variable_value");
and then use them as you want.
Alexandre
Definitely it's possible with "Tests"(or Post-Request) script.
But since you have 2 requests(and Postman force you there should be 2 separated requests) you should save response from first request into variable with setEnvironmentVariable or setGlobalVariable and after getting response for 2nd request - to parse response for first one and iterate over it, looking up by id given.
I have two tables in different databases. In a table A is the data, in the other table B are information for incremental load of the data from the first table. I want to load from table B and store the date of the last successful load from table A in a mapping variable $$LOAD_DATE. To achieve this, I read a date from table B and use the SETVARIABLE() function in a expression to set the $$LOAD_DATE variable. The port in which I do this is marked as output and writes into a dummy flat file. I only read on row of this source!
Then I use this $$LOAD_DATE variable in the Source Filter of the Source Qualifier of table A to only load new records which are younger than the date stored in the $$LOAD_DATE variable.
My problem is that I am not able to set the $$LOAD_DATE variable correctly. It is always the date 1753-1-1-00.00.00, which is the default value for mapping variables of the type date/time.
How do I solve this? How can I store a date in that variable and use it later in a Source Qualifiers source filter? Is it even possible?
EDIT: Table A has too much records to read them all and filter them later. This would be to expensive, so they have to be filtered at source filter level.
Yes, it's possible.
In the first map you have to initialize the variable, like this:
In first session configuration you have to define the Post-session on success variable assignment:
The second map (with your table A) will get the variable after this configuration of the session in Pre-session variable assignment:
It will work.
It is not possible to set a mapping variable and use it's value somewhere else in the same run, because, the variable is actually set when the session completes.
If you really want to implement it using mapping variables you have to create two mappings, one for setting the mapping variable and another for actual incremental load. You can pass a mapping variable value from one session to another in a workflow using a workflow variable. https://stackoverflow.com/a/26849639/2626813
Other solutions could be to use a lookup on B and a filter after that.
You can also write some scripts to query table B and modify the parameter file with the latest $LOAD_DATE value prior to executing the mapping.
Since we're having two different DBs, use two sessions. Get values in the first one and pass the parameters to the second one.
I have a lookup field in list in share point 2010, how to set a default value for that field at inserting operation
Using JavaScript, override the PreSaveAction method and push whatever you like into the lookup column. this happens just prior to the post to the web server, so you cna do all validation and checks.
Beware though, the value you insert must exist in the lookup list or the post will fail, ie don't push a value of "abc" if "abc" is not on the list of possible options fo rhte lookup column.
If you want to preselect some value in lookup control (dropdown) when dialog is open you need to do it by JS. You need to hook onload (JS) event of the page. There are some libraries that makes it easier to set SharePoint field values e.g. SPJS-utility. Common way is that you send id of item using URL parameter and get by JS and then set it to field. Speaking of lookup beware of the fact that SP renders lookup control in different way in IE for less than 20 items and for more than 20 item.
Can a SharePoint expert explain to me the ;# in data returned by the GetListItems() call to the Lists web service?
I think I understand what they are doing here. The ;# is almost like a syntax for making a comment... or better yet, including the actual data (string) and not just the ID. This way you can use either, but they are nicely paired together in the same column.
Am I way off base? I just can't figure out the slighly different use. For example
I have a list with:
ows_Author
658;#Tyndall, Bruno
*in this case the 658 seems to be an ID for me in a users table somewhere*
ows_CreatedDate (note: a custom field. not ows_Created)
571;#2009-08-31 23:41:58
*in this case the 571 seems to be an ID of the row I'm already in. Why the repetition?*
Can anyone out there shed some light on this aspect of SharePoint?
The string ;# is used as a delimiter by SharePoint's lookup fields, including user fields. When working with the object model, you can use SPFieldLookupValue and SPFieldUserValue to convert the delimited string into a strongly-typed object. When working with the web services, however, I believe you'll need to parse the string yourself.
You are correct that the first part is an integer ID: ID in the site user list, or ID of the corresponding item in the lookup list. The second part is the user name or value of the lookup column.
Nicolas correctly notes that this delimiter is also used for other composite field values, including...
SPFieldLookupValueCollection
SPFieldMultiColumnValue
SPFieldMultiChoiceValue
SPFieldUserValueCollection
The SPFieldUser inherits from the SPFieldLookup which uses the ;# notation. You can easily parse the value by creating a new instance of the SPFieldLookupValue class:
string rawValue = "1;#value";
SPFieldLookupValue lookupValue = new SPFieldLookupValue(rawValue);
string value = lookupValue.LookupValue; // returns value