How do you write a quick filter to check whether a User Picker (multiple users) contains less than 2 entries? - jira

We have a User Picker for multiple users to indicate how is reviewing an issue. We always want at least 2 people reviewing issues and would like a quick filter to show all issues with 0 or 1 reviewer.
I don't know how to access the length or size property of the field.

You can use size to access size property of a field.
size([User Picker Field]) <= 1
This returns all issues where length of User Picker Field is <= 1, thus complying with your 0 or 1 reviewer requirement.
Edit: This was for JQL I didnt notice.

Related

How do i trace multiple XML elements with same name & without any id?

I am trying to scrape a website for financials of Indian companies as a side project & put it in Google Sheets using XPATH
Link: https://ticker.finology.in/company/AFFLE
I am able to extract data from elements that have a specific id like cash, net debt, etc. however I am stuck with extracting data for labels like Sales Growth.
tried
Copying the full xpath from console, //*[#id="mainContent_updAddRatios"]/div[13]/p/span - this works, however, i am reliable on the index of the div (13) and that may change for different companies, hence i am unable to automate it.
Please assist with a scalable solution
PS: I am a Product Manager with basic coding expertise as I was a developer few years ago.
At some point you need to "hardcode" something unless you have some other means of mapping the content of the page to your spreadsheet. In your example you appear to be targeting "Sales Growth" percentage. If you are not comfortable hardcoding the index of the div (13), you could identify it by the id of the "Sales Growth" label which is mainContent_lblSalesGrowthorCasa.
For example, change your
//*[#id="mainContent_updAddRatios"]/div[13]/p/span
to:
//*[#id = "mainContent_updAddRatios"]/div[.//span/#id = "mainContent_lblSalesGrowthorCasa"]/p/span
which is selecting the div based on the div containing a span with id="mainContent_lblSalesGrowthorCasa". Ultimately, whether you "hardcode" the exact index of the div or "hardcode" the ids of the nodes, you are still embedding assumptions regarding the structure of page.
Thanks #david, that helped.
Two questions
What if the structure of the page would change? Example: If the website decided to remove the p tag then would my sheet fail? How do we avoid failure in such cases?
Also, since every id is unique, the probability of that getting changed is lesser than the index being changed. Correct me, if I am wrong?
What do we do when the elements don't have an id like Profit Growth, RoE, RoCE etc

Is it possible to set permission in Google Sheet for selected cells per user?

Scenario is simple: You as a teamleader managing team attendance in Google Sheet document. Every person should have the ability to edit rows that are only for him. So the person shouldn't be able to edit cells of colleague, but can still enter some data for himself.
Options that Google Sheet provide in the UI are restrictions to:
Protect whole sheet
Protect whole sheet with exception
Protect selected range on the sheet
All of those options provides ability to add/edit permission for this Restriction (this is not clear for first time usage). By setting the user himself in here actually cause:
Not apply restriction to him (so the user can still edit sheet)
User is able to edit restriction (this is kinda expected)
Question is if there is some way to prevent multiple users from entering multiple cells on same sheet, but he restriction will be applied per user?
Solution I'm looking for can be either from developer or classic user perspective.
I expected something like:
Lock whole sheet
Set permission for user A to edit range A1:B2
Set permission for user B to edit range B2:C3
I've visited How to protect ranges per specific users in google sheet? , but as stated above, it only adds editors, where the restriction is not applied to them.
When you lock the whole sheet, unfortunately it is not possible to unlock subranges of this sheet
The reason is that a locking of a sheet has a higher access priority than unlocking of a range.
As a consequence, you will need to use a workaround of splitting your sheet in different ranges and define different permissions for each range.
In your case:
Range 1: A1:A2 - only user A has access
Range 2: B1 - only user A has access
Range 3: B2 - user A and user B have access
Range 4: C2 - only user B has access
Range 5: B3:C3 - only user B has access
The rest of the sheet also needs to be split up in ranges, from which ALL editors need to be removed.
Obviously splitting up of ranges like this is very tedious, however what helps to automatise the process a bit, is using RangeLists.
I can recomend you use the RangeListApp library developped by #Tanaike.
UPDATE
There is a method called setUnprotectedRanges(ranges) which can overwrite the sheet protection.
Sample:
var protection = sheet.protect().setDescription('Sample protected sheet');
var unprotected = sheet.getRange('B2:C5');
protection.setUnprotectedRanges([unprotected]);
Mind that this method lifts the protection entirely, so you would still need to set a separate protection for the given range to make sure that only 1 user can edit this range.

Is there a way to conditionally format data validated entries to change the values within the cells themselves?

I have an attendance sheet I'd like to edit that has data validation pertaining to credit applied towards the overall attendance percentage, with a 1 meaning the person was there, .5 for late, 0 for calling off appropriately, -0.5 for calling off late, and -1 for no call not showing. In attempting to equate these numbers to the words associated with them, I'm not seeing a way to either: A) Make this human-readable with the entry of a 0.5 inside of the box being changed to late, but also usable within attendance calculation, or B) be able to pseudo enumerate my list of words to associate them with numbers
I've attempted to use most of the data validation and conditional formatting options, but I'm unfamiliar with the custom code that could be run to make this a possibility.
This is a copy of the sheet: https://docs.google.com/spreadsheets/d/1IXZqySfbED2TCX-yo1aScupdof1WZXhdQ820zlqiMn8/edit?usp=sharing
Under the Attendance tab
paste in B2 and drag down:
=IFERROR(ARRAYFORMULA((SUM(IFERROR(VLOOKUP(TRANSPOSE(C2:2),
'Data Validation'!C:D, 2, 0))/COUNTA(C2:2))*1)))

Automatically updating Data Validation lists based on user input

I have a very large data set (about 16k rows). I have 10 higher level blocks and within each block I have 4 categories (10 rows for each) which use Data Validation lists to show items available in each category. The lists should automatically update based on user input. What I need your help with is that I want to use the same data set for each block and preferably a least calculation/size intensive approach. I have put together a sample file that outlines the issue with examples.
Sample File
Thank you for your help in advance.
Okay, I've found something, but it can be quite time consuming to do.
Select each range of cells. For instance, for the first one, select B3:B18 and right click on the selection. Find 'Name a Range..." and give it the name "_FIN_CNY". Repeat for all the other ranges, changing the name where necessary.
Select the first range of cells to get the data validation, and click on "Data validation", pick the option "Allow: List" (you already have it) and then in the source, put the formula:
=INDIRECT($G$4&"_CNY")
$G$4 is where the user will input. This changes as you change blocks.
_CNY is the category. Change it to _CNY2 for the second category.
Click "OK" and this should be it. Repeat for the other categories.
I have put an updated file on dropbox where you can see I already did it for the data of _FIN for categories CNY, CNY2 and INT and did the one for _GER as well. You'll notice the category of INT for _GER doesn't work, that's because the Named Range _GER_INT doesn't exist yet.

Quickbooks: Adding a negative value to an invoice using the QBDSK

Is there any way to add a line item containing a negative amount to an existing invoice?
I'm using QBSDK7 and QB Enterprise. (and if it matters .Net 3.5)
What we're attempting to do is automate the way we're creating invoices. We're already pulling in employee's time and applying it to the correct invoices, but when we go to add credits (just a negative amount on a line item on the invoice) using
InvoiceLineMod.Amount.SetValue(-1234)
it fails with the error "Transaction must be positive"
I've also tried adding a Service Item with a negative amount and giving it a positive quantity and I get the same result.
This seems like such a no-brainer as we have been doing this manually for the last 10 years. I'm guessing there is artificial restriction on this.
Some things to consider:
Credit Memos are no good as we need to display exact details of the reduction on the same page.
We don't have payments to apply yet in most cases.
This need to be done before any retainers are applied.
Any help would be greatly appreciated.
Can you show the complete code you're using to modify the invoice? Can you also show the exact error message you're getting?
It is possible, though to do you need to make sure that you're using a Discount Item as your ItemRef type (a Service Item will not work), and you need to make sure that the transaction as a whole is for a positive amount.
Sometimes our app has to adjust an invoice down with a negative number. I have been able to add negative line items using the following code. I have to set a quantity and a rate, instead of setting the amount.
IInvoiceLineAdd ila = ia.ORInvoiceLineAddList.Append().InvoiceLineAdd;
ila.ItemRef.ListID.SetValue(GetQBID(JobKey));
ila.Desc.SetValue("Adjustment");
ila.Quantity.SetValue(1);
ila.ORRatePriceLevel.Rate.SetValue(-1.00);
Quickbooks doesn't allow you to post an invoice with a negative balance. If you try to do it through the UI, it prompts you to create a credit memo instead. (And vice-versa if you try it with a credit memo.)
You can enter negative quantities and/or prices into the line items, but the total of the invoice has to be >= 0 or it won't post (i.e., add other line items that offset the negative amounts).
The solution is to use credit memos. Your client-side processing will be more complicated, but it's the only choice with Quickbooks.

Resources