Google Tag Manager Trigger using RegEx - regex

I'm troubleshooting an event that uses an 'All Elements' trigger associated to a 'Click Class' lookup table.
The lookup table has four input values corresponding to classes added to target HTML elements. The event needs to fire when any target element is clicked.
From what I can determine through testing, if a clicked element has more than one class (including one of the target click classes), the Lookup table as I've configured it does not receive the value (the eventLabel holds the lookup variable is null) and the trigger does not fire. I've verified that the class is present in the datalayer, in the click class variable.
The LookUp table passes unique output values for each input, and the trigger has a simple regex, as follows:
Trigger fires when 'My LookUp Variable' matches RegEx (ignore case) heading|button|image
The only time it fires is when the heading is clicked -- this is the element that has only the target class. All other elements have other classes in addition to the target class.
Also, I'd use click ID for this but the target elements exist within a search result component that appears many times on the webpage. Hence, use of the ID attribute would be semantically incorrect.
Anyway...any help here would be appreciated.

Related

How does Web Source operation's URL Pattern get it's argument when it's assigned a parameter?

when you AutoREST-Enable a table through object browser> click table> REST tab, you will get a RESTful URI. If you then build a web source using that RESTful URI, you will get five operations - GET with a dot as URL pattern and GET, PUT, POST and DELETE operations with URL pattern has the value of :deptno. When you build a report with form on that web source you will find that all database operations work well, you can insert, update and delete through the form, and you can run the report to get all rows in the table. I need to know how the process work in the background? How the automatic row processing process knows which operation and handler to use? I know that Interactive Reports for example looks for the operation that have "Fetch Rows" it's database operation. So, I assumed that the Form's automatic row processing looks up for the Web source's operation with the database operation that relates to the process to be executed. For example, (correct me if I'm wrong) when clicking CREATE button, it denotes that an Insert process will happen, so, it will search for the web source's operation with the database operation "insert row", then it will find the handler that relates to the HTTP method attribute's value "POST". And the same goes for UPDATE and DELETE. I want to know if I am getting it right and I need to know how the URL Pattern gets it's argument for :deptno?
your understanding of the form region picking the Web Source Operation is correct. Within the Form Region, the name of the clicked button (:REQUEST) actually determines the DML operation (CREATE = Insert, SAVE = Update, DELETE = delete).
A :deptno URL parameter must also be created within the Parameters section of the REST data source. Once that is in place, you'll see the form region node in the Page Designer Tree having a Parameters node - there you can map the Web Source Module parameter to a page item, an application item or something else.
As already mentioned, the primary key values are special in a Web Source Module. In your case, the :deptno placeholder (as part of the URL) corresponds to the DEPTNO data profile column.
For the DML handlers (PUT, POST, DELETE) you don't need to define these as Web Source Module parameters, but the URL placeholders must match the column names in the data profile. This is by design - Web Source Modules are implemented to work this way.

How to access another field/combo in the rowedittemplate during creation of a grid row when selectionChanged or checkValue happens?

The situation is as follows :
I am creating a row in the grid. I have several properties among which are one combo called 'department' and one field called 'name'. The business rule is that all the 'names' in a 'department' must be unique. The grid does not load all the department-name combinations so I have to make a call to the back-end. I want to make this call when
selectionChanged on the 'department' combo happens or
when 'checkValue' of the validator options of the 'name' filed happens.
This way I check when either changes. The problem is that this happens during creation and there are no rows in the datasource and no accumulated rows in the transaction log.
How can I access the fields of the 'rowEditTemplate' during creation during these particular events in order to check my values? Is there any other/better way to achieve this?
The editors are not created until you do the first edit. You could use the editRowStarted event to attach your editors logic. They are obtainable using the editorForKey method.
editRowStarted: function (evt, ui) {
var comboEditor = ui.owner.editorForKey("ProductDescription");
}
I created a small fiddle that assigns a data source for the combo on editRowStarted. It should work as a starting point for what you are trying to achieve.
http://jsfiddle.net/hfen0qea/

Set default value for a field in share point 2010 list

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.

My test script is not finding items in dynamic web list control - list in code not updated with current info

I am having a problem in QTP with selection of a web list box and I have exhausted what I know to do to resolve it. I am hoping someone can help.
There are 5 controls in a container, 2 webedit controls and 3 weblist controls. Together, they allow entry of accounts associated with a customer, and there can be 16 accounts for any customer. There are only ever five controls active at any time, whether editing or entering information for an account. When the information for an account is entered and accepted, it changes to a read-only table row and a new set of controls appears below it for entry of the next account.
The information entered in these controls is the account number, type, description, designation, and status. The status value is contingent on the designation, and the items in the list change dynamically depending on what the user specifies for the designation. The status list is not enabled until the designation is specified.
After some experimenting with timing, I was able to get past an issue where the status list for the first account was seen by QTP as disabled even though it was clearly enabled. I was then able to advance to entry of the second account.
I change the designation on the second account and try to select an appropriate item (specified in a data table) in the status list. My specification from the data table is never found. I figured it was a problem with verbiage differences and also that I should probably anticipate that and address it now, so I wrote a function to accept three parameters, the list and up to two search items. My function searches the listbox passed to it and looks for a match (full or partial) on the search items it receives. Here is where I encountered a significant problem.
The list of the control my function received was from the previous iteration of the test, corresponding to the designation of that account. This is why my function was not finding the selection item. The list on the screen shows the appropriate items, which suggests that I am looking at the wrong object. I also get the ‘object is disabled’ message when I put my data table value directly into the list with the select statement.
The active controls are displayed below the readonly presentation of the previously entered accounts. I am very new to QTP, but I also read documentation. My only theory at this point is that ATP is not passing the right list to my function… that perhaps that how it was learned included the position, which will change each time. However, the spy identifies the screen control as the same item I processed for the preceding account, which makes my theory suspect. In addition, the other four controls, which are not dynamically changing, do not present the same problem. I can put the information in them consistently.
I apologize for the length of this question, but I wanted to be as thorough and clear as possible. Can anyone help me get past this obstacle.
There are many possiblities why it is exposing this behaviour, so let's start with something simple:
Did you try a myWebList.Refresh call before you do something with the listbox? Refresh re-identifies the object.
Have you put a break point (red dot) inside the custom function. Just see what is happening there. With the debug viewer you can enter a realtime command in the scope of that function like msgbox myWebList.exist(0) or myWebList.Highlight
Can you see how the disabled property is propagated to the webpage? If you can 'Object Spy' it as TO property, you can add it in the GUI Map description.
A more sophisticated aproach is to create a Description with the weblist properties. If you can read the disabled property as an RO property from the 'Object Spy', you can use it as an identifier like "attribute/customDisabledProperty:=false".
If you cannot correctly read the disabled property, you can create a description object and do a count on the amount of items that match that description on that page with numberOfLists = Browser("my browser").Page("my page").ChildObjects(myDescription).Count and get the last list with Set lastList = Browser("my browser").Page("my page").ChildObjects(myDescription)(numberOfLists-1)
Keep us informed. Depending on how this works out, we can work into a direction for a solution.
I figured this out early this morning. There are 4 different list boxes used, each made visible or enabled dependent on the selection of the previous list. This is why the spy found the one listed when I was using it and also why the items in the list were not appropriate to what I had selected and also why it appeared disabled to QTP but enabled to me.
I was selecting the same designation when trying to spy it. It was intuitive that the controls were all the same. I am also a windows programmer and I would have populated the same list each time with the appropriate list items, and I presumed that was what the web developer was doing. It was not and it took some time to figure that out. Now that I figured it out, everything is working fine, and I came back to report that. This was a significant, time-intensive lesson.
Thank you very much for your input. It is still useful because I am very new to QTP and every thing I learn is of value.

Is there a table which holds all possible states of a determined work Item type in TFS?

I'm developing a Time Tracking system in TFS so we can control how much time is spent in each task. I'm doing it by checking changes in work items states, and recording the time between states.
I'm using WCF and TFS2010 alert subscription.
Then I noticed the State column in the WorkItem table holds a string, instead of an ID pointing to a State.
With that in mind, I noticed I would have to parse each state and check if it corresponds to some string. And then, some day, someone might want to change the State name. Then we're doomed.
But before I hardcore (or put in some random config.xml)... let me ask, is there a table which holds all possible states of a determined work Item type in TFS?
The states of work item types are stored in the process template files. You can export the work item type to an xml file using witadmin.exe and see the allowed values of the "State" in there.
Programmatically, you can use the Microsoft.TeamFoundation.WorkItemTracking.Client namespace to get the WorkItemType object of your work item type, look for the FieldDefinition object of the "State" in the FieldDefinitions property, then get the possible states from the AllowedValues property of FieldDefinition class.