How to get the Attribute name(when duplicate attribute) from the XML using XPATH? - xslt-2.0

Can you guys help me in the below scenario using XPATH when we have a same attribute name twice for the same node as below:
<wd:Worker_Type_Reference>
<wd:ID wd:type="WID">be264fa6cb8b0175451b3a2012baaf10</wd:ID>
<wd:ID wd:type="Employee_Type_ID">Permanent</wd:ID>
</wd:Worker_Type_Reference>
<wd:Worker_Type_Reference>
<wd:ID wd:type="WID">be264fa6cb8b0157dffabd2212bab810</wd:ID>
<wd:ID wd:type="Contingent_Worker_Type_ID">Vendor</wd:ID>
</wd:Worker_Type_Reference>
I need to get the name of the attribute i.e Employee_Type_ID and Contingent_Worker_Type_ID. The above snippet is a part of the code, just to make it simple I copied the main code. The wd:type will change based on the type of employee - Employee or Contigent Worker. To fetch the type of employee I have the only one option to get this attribute name.
I have seen other questions with the same scenario, but the duplicate attribute scenario is not there. I tried as below:
wd:Worker/wd:Worker_Type_Reference/wd:ID/#*[local-name()='type']
With this I am getting both WID and the Employee_Type_ID OR Contingent_Worker_Type_ID.
No clue how I can get the second value (Employee_Type_ID OR Contingent_Worker_Type_ID) for each Worker reference.
expected result for the snippet above is:
Employee_Type_ID
Contingent_Worker_Type_ID

Related

jira createmeta not showing all customfields

If I navigate to /rest/api/2/issue/createmeta/PROJ/issuetype/N (in this case, I'm getting Task), the list of fields returned is incomplete. There are a number of customfields that are in use (I can see them both in the tickets themselves, and also in /plugins/servlet/project-config/PROJ/fields ) that are in the createmeta data.
I'm really trying to do this in python jira, where I'm using "expand='projects.issuetypes.fields'" in the createmeta() call, but I figured I'd double-check the results in the rest API directly, and I'm getting the same results there, too.
This is happening in jira 8.20.7.
Essentially, what I'm trying to do, is to programatically get a name/id mapping of all fields in the ticket type. I'm having far more difficulty doing that than I thought there would be. I would do it based on /rest/api/2/field but the jira admins have allowed some duplicated names...
EDIT: I realized that it might be worth noting that some of the fields I'm looking for are coming from a ServiceDesk form, although, as far as I can tell, there's no way to determine that, since one of the missing fields contains the name of the form.
Why are you using createmeta endpoint?
Instead of that, in order to get all of the customfields and their values; just note their id and get the values from /rest/api/2/issue/{issueKey} endpoint.
When you send a GET request to /rest/api/2/issue/{issueKey} endpoint, you will get a JSON object which contains "fields" object in it.
And using the "fields" you can determine all of the values that include system fields (description, assignee, etc.) and custom fields (like customfield_<customfieldid>).
And for a general approach, you may want to look at the field types in that response.

Looking to fill out most or all of the Fed Ex "Create Label" page using URL query string

Looking to create a shipment on www.fedex.com
But fill out most of the fields using a query string at the end of a URL.
Seems like this might not be possible, but need help figuring out how to know whether it is or not.
My "Create Labels" page has a URL ending in -- ?method=doInitialize&utype=null ,
or else sometimes ...
-- ?method=doEntry&link=1&locale=en_US&urlparams=us&sType=F
so it seems promising. Just not sure how to access the names of the required fields (Contact name, Address 1 and 2, etc ) besides guess and check.
Thanks!
--------- Destination Section Parameters Found
The query string parameters for the destination contact field are, at the time this answer was written :
toData.addressData.contactName
toData.addressData.addressLine1
toData.addressData.addressLine2
toData.addressData.zipPostalCode
toData.addressData.city
toData.addressData.stateProvinceCode
toData.addressData.phoneNumber
psdData.mpsRowDataList[0].weight
Of course, they need to be appended to the original URL using valid query string syntax and URL encoding.
--------- How Were These Found ?
These were each found using the page inspector. I found that it is important to cut through the noise by zeroing in on the exact field where the data needs to be entered, and opening up the page inspector to that location.
Right click (Win) or control click (Mac) > "inspect"
This will bring up the following text in the inspector. By trial and error, I discovered that the "name" fields correspond to the working query string parameters.
The part we are looking for :
This corresponds to the query string parameter ...
toData.addressData.addressLine1
... originally listed above.
--------- Unsolved Parameters
It's a mystery why this same rule doesn't apply in the same way to other values in the page, like service type (e.g. "Priority Overnight") or package type (e.g. "FedEx Box"). The following, for example, do not fill as expected, even when using the exact same "name" field from the page inspector.
psdData.mpsRowDataList[0].carriageValue
psdData.serviceType
psdData.packageType
billingData.referenceData.yourReference
Maybe it's a URL encoding issue? Anyway, hope this helps.

Query string parameters are not working to slice the data after publishing report

I have created a report where I created one calculated column which holds the value of dynamic URL. It has ID as parameter and I want to slice the data based upon that after publishing. When I am publishing this report to powerbi.com and I am using this URL to filter out the data, it shows me all the data. The filters through URL is not working.
I just went through a blog and when publishing through query string parameter it says that it has a limitation that it doesn't work when it will be published to web. What does it mean?
Below is the calculated column:
https://app.powerbi.com/groups/ce347380-637d-4700-838f-f7b00294256c/reports/374c3b7b-18f0-46f6-b5ec-2c97cbb01611/ReportSection?filter=Append1/Append1[SIMPrjReqID] eq '"&Append1[SIMPrjReqID]&"'
where Append1 is table and SIMPrjReqID is a column on which I want to filter out the data dynamically.
Please advise!
it has a limitation that it doesn't work when it will be published to web. What does it mean?
This means that passing URL query string parameters to filter data works only when applied on the report's URL, as you see it in the browser's address bar when you open it in powerbi.com, and not on the URL that you get when you use Publish to web option to make it public:
This filter does not work, because you didn't specified the field name correctly:
?filter=Append1/Append1[SIMPrjReqID] eq '"&Append1[SIMPrjReqID]&"'
As noted in the official documentation, the filter is passed in this format URL?filter=Table/Field eq 'value', where Field is the name of the field. So your query string parameter should look like this:
?filter=Append1/SIMPrjReqID eq '"&Append1[SIMPrjReqID]&"'

JIRA comment tag name

While commenting on JIRA tickets, #username can be used to tag a team member. The thing that bugs me is that when I try to tag any team member, there is a special encoded text appear (something like this [~gbuc13]) for every person you tag in.
Now its very difficult to find which member you tagged in your comment by seeing this code. Is there any way that this strange encoded name could be replaced with a proper, meaningful names so that when a user is being tagged, [mike] is appeared instead of [~gbuc13]? I know this change will have to be adopted by every team member to define their aliases, but I am wondering where this (alias?) could be set.
The change you describe is is the difference between the saved view and the edited view and can't be changed:
at edit time you see the alias
once saved you see the full user name (which links to the Jira profile page showing all their activity)

Search Version jira rest api

I need to get all issues by version id. My query is like:
http://archwork:2990/jira/rest/api/2/search\?jql\=project\=GP+and+fixVersion\=10001
working fine, but I want to get issues by VERSION
Link like:
http://archwork:2990/jira/rest/api/2/search\?jql\=project\=GP+and+version\=10001
returned "Field 'version' does not exist or you do not have permission to view it."
The two built-in version fields in JIRA can be accessed in JQL as fixVersion and affectedVersion. I suspect that you want the latter.
If you have another custom field (which is a version-type field) that you want to query, the error message suggests that you may not be using the correct name for it. The best way to check this is to type your JQL into JIRA's Issue Navigator manually (in the advanced search) and to take advantage of the dropdown box with field name suggestions to get the correct field name.
One way to bypass the problem of determining the correct JQL field name (which sometimes requires quoting, which gets slightly more messy if you are also URL-encoding the result) is to simply refer to a field by the custom field ID instead.
You can find the CF ID of a field by going to Admin->Issues->Custom Fields, finding the appropriate custom field, mousing over the "Configure" link, and then looking at the URL query parameter for customFieldId, and then use the syntax cf[xxxxxx] in your JQL instead of the field name, where xxxxxx is the custom field number.

Resources