SharePoint online reset ID number every year - sharepoint

I'm new in SharePoint online.
I've created a list, customized its form and flows.
But my question is aside from deleting the list to reset the ID number is there a way to reset it every year automatically without deleting the list? So that I'm not going to recheck and re-edit the form of the list.
Like for example today 2019 the ID count is over 500+ and by next year 2020 the ID number will reset into 1 or 0. So in short, ID number will reset every end of the year.
My list number is depending on ID number.
Example.
eNUM-2019-000
eNUM-2019-001
...
then for next year
eNUM-2020-000
eNUM-2020-001
...

In SharePoint Online, we can't reset the list item ID directly.
As a workaround, we can save the list as template and create new list base on the template in the new year begin.
Or you can create another Number column and maintain the ID in the new column.

Related

Reset Increment Variable for Sample ID

I am new to Power Automate flows. I was tasked to create a Unique Sample ID based on parameters from a SharePoint list, when an entry is created. I have created a SharePoint list, whose function is to hold the increment variable, which is my counter. The current flow increments this counter variable, whenever an item is created in the main SharePoint.
The Sample ID is suppose to reset every year based on the logged date of the incident, which is different than the stored date. For example, 2020SPI1, 2020SPI2, and 2021SPI1, 2021SPI2. I am trying to get an idea on how to do this.
I do not want a flow that resets the counter every year, since the stored date of the entry can be different from the date that the incident occurred.
In Order to make your format like 2020SPI1
Step 1: Initialize a vairable named as PatternId
Step 2: Set Variable. You can use string concat function in value of variable as following
concat(formatDateTime(utcNow(),'yyyy'),'SPI',items('Counter')
First argument here will produce current year: 2020.
Second argument is a static string: SPI.
Third your counter value from the list holding incremented number.
Then finally you can use PatternId to updated the id in your list column. Hope this can help you out.

Fetching date value from a SharePoint-list, to use in date&time specific field in flow

I'm trying to design a Microsoft Flow, which will create a outlook calendar event entry based on information in a SharePoint-online list.
The list will contain a value for a DueDate its a column of type Date, not including time.
I want to be able to create a outlook calendar entry on the date based off the duedate column. The calendar entry form in flow allows via dynamic content to add dates that also include time, however date columns not containing time cannot be added that way.
Is there a workaround to this, some expression that would allow me to fetch values from columns more freely and then possible append a time to it
I have tried converting the column in sharepoint to a Date with Time column and that workaround worked, however its not what I'm looking for. Id like to know how to be able to work around this because I don't necessarily want my column as a date-time column which can cause problems later on.
I have tried this expression:
formatDateTime(concat(item()?['DATE'], '08:00')'yyyy-MM-ddThh:mm:ss')
But I know this is wrong and it doesn't work. I'm simply not sure how to do it.
https://puu.sh/Df5ni/05cb882b23.png
I want the flow to add a calendar entry based off the due date column which i can append my own time to like the start of the day and last til the afternoon.
Actual results are I don't seem to be able to use a date column, just a date-time column for start and end times of the event, date column without time doesnt appear in the dynamic content list.
If there is some way to manually fetch values instead of using the dynamic content that is very powerful and can then possibly be converted to the right format using additional code.
Date column name in my list is date_without_time of type Date (Add time set to NO):
New element:
Function used in Create event (V2) action:
formatDateTime(triggerBody()?['date_without_time'],'yyyy-MM-ddT09:35')
Result:
Calendar:

SharePoint Calculated Field resets on item edit

I am using a SharePoint list that was migrated from an old Windows 2003 server to an existing 2008 server. This list is used to track issues raised by users against another application - a list of jobs to do if you will.
In the old list there was an Id field. When the list was recreated in the new area the assigned ID number was different, for example
Old ID New ID
--------- ---------
5 204
6 2
7 3
8 159
9 4
This assignment does appear to be fairly random.
To negate this a calculated column was created, so IDs raised before the migration use the Old ID number, and new calls raised after the migration use a calculated value. The calculation is
=IF(ISBLANK([ID (Old)]),ID+8,IF([ID (Old)]<=348,[ID (Old)],ID+8))
This compares the ID (Old) to blank, and if so, it is a new call and should have the default ID number, plus 8 (I think there was a total of 8 calls made during development that were then removed).
Otherwise if the Old ID number is less than 348 (the call number when we migrated), use the Old ID number.
If neither condition is met, simply set the ID to the new ID number plus 8.
This works fine when creating new calls.
The problem arises when I edit a call. For example if I set the ETA to a new value and save the call, the Calculated ID is always reset to 8.
I can fix this by going in to List Settings -> Opening the calculated column -> and clicking OK. This reapplies the calculation and everything is numbered correctly again.
For information - due to the environment this is deployed in I am not able to use SharePoint Designer at all.
The question is, how can I stop the renumbering when I edit an item?
The ID field behaves a bit oddly with calculated columns. A calculated column formula will find the ID of an item and resolve it properly when items are created or when the formula is modified, but as you discovered, when an item is modified, the formula can't find the ID value. (My guess is that this has to do with the ID field not being included in the list of column values being sent to the database on update, perhaps because the ID field should never change.)
One way around this is to use a workflow (or a custom event handler, if you have too much time on your hands) to copy the ID field to another column, such as a number or single line of text column, whenever an item is created. You can then use that new column in your formula instead of using the ID column.
To prevent people from updating your dummy ID column, you can hide it from the forms. To do this, first enable management of content types for the list, then edit the Item content type, find the new dummy ID column, and change it to "Hidden" (instead of "Required" or "Optional").

How can I count only unique occurrences of a value from table using multiple criteria?

I am trying to calculate the percent of users for each role (admin, mod, general user, etc.) who have logged in over a specified timeframe (1 month, 3 months, 6 months, 1 year). Editing the data table that I'm pulling from is not an option as this spreadsheet is supposed to be self-calculating (if that makes sense). Right now I only need the numbers because calculating the % should be simple.
The columns that I am using are id, eventTime, ScreenName, and userGroup.
For example, I want to count how many users from the userGroup "admin" logged in within the last month. Using ScreenName because it's unique and evenTime because ya.. The data I am pulling from records the time, username, user group, and the page name for every page the user looked at on the website so a user may have several entries on the same day.
The code I have written so far:
=SUMPRODUCT(((data!$B:$B>(TODAY()-30))*(data!$B:$B<=TODAY()))*(data!$G:$G=G$1))
'data' is the sheet that I'm trying to count from.
Here is some pseudo-code to help:
SUMPRODUCT((eventTime>30 days ago)*(evenTime<todays date))*(userGroup = referenced userGroup))
If I were to log in as an Admin and than proceed to look at seven pages on the website, the data would have seven different rows storing the page/time/myusername/myrole data. The equation above is counting each individual instance that my username pops up instead of how many users have logged in. e.g. I want it to return "1" because only one user logged in that month, even though they looked at several pages. But the equation is returning "7".
TL:DR I'm trying to list the number of active users within a specified timeframe. My formula was for one month. But all I need is for it to count only unique screenName/every screen name once.
If you have a list of all the ScreenNames (listed once only, named ScreenNamesList) then the simplest way to do this is like this, assuming ScreenNames are in column A:
=SUMPRODUCT((COUNTIFS(data!$B:$B,">"&TODAY()-30,data!$B:$B,"<="&TODAY(),data!$G:$G,G$1,data!$A:$A,ScreenNamesList)>0)+0)
....but if you don't have such a list then you can use this formula - note ranges reduced, whole columns will be very slow:
=SUM(IF(FREQUENCY(IF(data!$B$2:$B$1000>TODAY()-30,IF(data!$B$2:$B$1000<=TODAY(),IF(data!$G$2:$G$1000=G$1,MATCH(data!$A$2:$A$1000,data!$A$2:$A$1000,0)))),ROW(data!$A$2:$A$1000)-ROW(data!$A$2)+1),1))
formula needs to be confirmed with CTRL+SHIFT+ENTER

Filtering a view in SharePoint list based on a year

I'm using SharePoint 2010.
I want to create new view for my list. The list contains a column called Year, which is a number and contains, as name suggests, year. Eg.:
2012
2011
2010
2009
I would like create a view, where I would display only last 3 years. Under creating new view, I go to Filter, choose Show items only when the following is true:, pick column Year and... this is where I get lost.
How to write a condition, that a number should be greater that current year minus 3? I tried
[Year]-3
but this obviously couldn't be so simple. Please help me write this condition.
[Today] returns the current date so you can use the following formula:
[Year] > YEAR([Today])-3

Resources