Subtracting value across multiple lists in Sharepoint 2010 - sharepoint

I am attempting to perform a simple subtraction function across two lists in Sharepoint 2010.
I have one list called Inventory that has part number, part name, and quantity.
I have a second list called Tasks that has title, description, status, used part, and quantity.
I have a workflow rule that states the following:
The issue is that it's just throwing an error when I run a test task with a status of completed, used part selected, and quantity field holding an integer value.
I am creating the workflow and attached it to the Tasks lists, so all current item equal items in the tasks.
The end of update item in Inventory I am setting the variable New Inventory to be the new value of quantity in the Inventory lists.
Any help with this would be great. Thanks.

Disregard, found out during the CurrentItem: Quantity lookup i had set the part name to string instead of lookup value.

Related

How to create a number field with prefix (ex: 00001) that increments whenever a document is added in SharePoint Online?

I created a calculated column and concatenated the id with a prefix, but it didn't work as expected.
The reason was that whenever i upload a file, the formula in calculated field that contains the ID with the prefix is executed, then SharePoint creates the ID.
So, the ID is being calculated as empty and only the prefix is showing.
What I used:
=CONCATENATE(REPT("0",MAX(0,5-LEN(ID))),ID)
What i would like to create is a number field with a prefix (ex: 00001) that increments whenever a document is added in SharePoint Online.
In other words, it's like the ID column in a list but with a prefix of five digits.
Therefore, is there any solution for this problem?
Thank you 😁.
Using the calculate column formula, when creating an new item, the ID column and the calculate column are created at the same time, so the value of the ID column cannot be obtained, so the calculate column will be displayed as 0.
But you can solve this problem by creating a flow.
Please refer to the screenshot below:

Prevent duplicates across multiple sublists

Our organization runs a daily transaction list (via saved search) to forecast our opportunity pipeline. For this saved search, we set the customer mainline to false to eliminate duplicate values in our search.
I've built a saved search text formula that references the customer sales team, which I understand is a sublist. This sublist doesn't play nicely with my transaction report and results in duplicate values.
What I want to have happen is for the transaction line item to pull in the name of the sales team member who has a sales team role of "team lead". If there isn't a sales team member with the team lead role, then I want the result to be blank. We do not have any sales teams where there are two team leads, so we will never run up against this.
The problem I'm getting is duplicate values. The report interprets my code to mean if a customer has a sales team member with the team lead role, then duplicate that line item as many times are there are sales team members. As an example, I have a customer with 8 sales team members. My code results in 8 duplicate line items and one line item has the name of the team lead while the rest are blank.
Thoughts on how to resolve? Thank you in advance. My code looks like this:
I cannot change customer main line to false, as this is makes it even more complicated. Leaving customer main line as false displays exactly what I need currently, with exception of the name of the team lead.
CASE
WHEN {customer.salesteamrole} = 'Team Lead'
THEN {customer.salesteammember}
ELSE NULL
END
What I'm looking for is one line item for each transaction and simply the name of the team lead on that transaction. Perhaps the answer is to create a custom field, but I'd like to think the solution can be accomodated in a transaction report.
You can set a filter in the Criteria tab to make sure only the lines that you want are returned. In the Criteria tab under Filter, select the Formula (Numeric) option, and set the Formula to be:
CASE WHEN {customer.salesteamrole} = 'Team Lead' THEN 1 ELSE 0 END
then choose 'equal to' in the operator field and put 1 for the value.

Sharepoint calculated field long time to calculate

I have made a SharePoint list that has a calculated field that is used as a unique identifier for each item. The field is calculated using the item id. The formula is as follows:
="TY0"&(TEXT([ID]+3200,"#####"))
The problem is that the calculation is seeming to take 20 mins or longer to happen. The field will show as "TY032000" until he calculation happens. If the field is changed via settings or SP designer and then changed back to the original formula, the calculation happens with no issues.
Same answer and some more workarounds at: columns dereferencing in SharePoint's calculated column
It is not 20 minutes, you can wait forever if an Item is never changed.
ID is empty for NEWly created items because the Formulas run BEFORE the Item is written to the List where it gets its ID value.
ID is not listed as an available Column when you create a Calculated Column.
As you experience, ID is updated when an Item is changed.
So add a Workflow which updates (anything in) the Item on New Item creation to trigger update of the Formula (now using the correct ID value)

Add up values from matching fields in a linked Sharepoint list

I have 2 lists, say, Fruits & Orders.
Orders has a number field FruitID that links to the ID field of Fruits.
Orders also has a number field OrderValue which stores the value of the specific order.
I want to find out the total sale for a particular fruit. I am doing this calculation in a workflow for the specific fruit. Is there an easy way (read 'no coding')?
See the list of standard workflow actions here:
http://office.microsoft.com/en-us/sharepoint-designer-help/workflow-actions-in-sharepoint-designer-2010-a-quick-reference-guide-HA010376961.aspx
There is no select, or looping functionality.
I suggest writing a custom workflow activity, sand boxing should work
http://www.wictorwilen.se/Post/Sandboxed-workflow-activities-in-SharePoint-2010.aspx

Can I create a COUNTIF calculated column in SharePoint?

Is there a way to create a SharePoint calculated column that returns a count of the number of entries in a list? So If I have 3 customers in my list with the company "Starbucks" I'd like the field to return "3"
(Edited some wording for clarity per suggestion from dariom).
You may be able to get what you want with another list using a not-so-well-known variation of a lookup column.
Let's say you have a list called Companies with values in the title column like "Starbucks", "Peets", etc. Now you also have the Customers list you refer to, but the "Company" column is a lookup column pointing to the title column in the Companies list.
You can add a count very similar to what you described to your Companies list. Go to your Companies list, add a column of type "Lookup" referring to the Customers list and you'll notice that in the drop-down area where you define the lookup if you point back to the Customers list, you'll have a new option called "Count Related". This is here automatically because it recognizes that the Customers list has a lookup pointing back to this one. Select that Count Related option and now your Companies list will have a column counting how many customers are associated with that company.
No coding, Javascript hacks, or anything. Just hidden SharePoint auto-magic.
No, I don't think there's a way to do this using the out-of-the-box calculated column.
Some other ways you could accomplish this are:
Create a view for your list that with a group by on the company field and include the total count. This is easiest, but might not be exactly what you're looking for.
Create a custom column type that executes a CAML query to find items that you're interested in. There is a learning curve if you've not done it before and if the list that you're adding this custom column to has lots of rows, you'll be executing a query for each row which is inefficient - it'll be OK for a small number of rows.
Use an event handler on the list that updates a column value each time a new item is added or removed from a list. This is easier, but can also be inefficient if you have a large number of items in your list.
As dariom said (damn my slow typing skills, +1!), only the current row can be operated on with calculated columns by default in SharePoint. There are a couple of documented workarounds involving SharePoint Designer or jQuery, though.
You can get a Count of specific list items in an XSLT Data View
To do this you will need SharePoint Designer.
Right click on your SharePoint List view (ensure the list view contains the field you want to filter by) select convert to XSLT Data View. Then in the Data Source Windows select Data Source Tab and drag and drop the field you want to get a total on for the specific items into where you want it displayed in your XSLT Data View. Click on the numerical value that is showing you should get a lightening bolt icon, select the drop down and choose Count, then select again and choose Filter. Select "Click here to add a new clause" then choose your field name again and enter your unique value as Starbucks and click OK, you can repeat this process for other fields you want the totals on. You will now see the total number of Starbucks items in the list.
I got something similar to work in a way similar to Niall. Basically, I:
Based on the source list, created a Data View Web Part (DVWP) on a "test" web
part page.
Added the footer column, which gives a count.
Set the filter for my conditions (i.e., the items I want to count).
In the code, deleted the recurring items row.
I was left with just the footer, which displayed a filtered count for all the list items. I further customized the footer by taking out the shaded background. Finally, I exported this web part and imported it onto the page where I wanted users to see a total of items in the list (which met the criteria).

Resources