Power Apps SharePoint form setting date/time field to blank - sharepoint

I have a form that sits on top of a O365 SharePoint site list with a simple submit button to set the status and the submit date like this:
Patch('LTRequest', ThisItem,{
SubmitDate: Now(),Status:Text("Pending Approval")});
Back();
What I want to do is create a reset button to change the status and set the date to blank or nothing. But no matter what I try the date is not affected and no error is thrown. Here's what the reset button looks like:
Patch('LTRequest', ThisItem,{
SubmitDate: DateValue(Blank()),Status: "Draft", ApprovalDate: Blank()});
Back();
Any ideas how to do this?

From my own experience earlier this year, and my investigation, you can't clear a datetime field in SharePoint from PowerApps..
I know - crazy! It may be fixed now but it doesn't like it is..
There's a workaround here
"I ended up adding a second column in sharepoint
Date/time and text
I set text to be the date column that shows in sharepoint. Date/time column is hidden.
I set text field to = date or blank"

You can enable an experimental feature to get around that: Formula-level error management
However, you might introduce more errors/promblems to the app by turning that feature on.

I'd remove the Back() statement during debugging. You might actually be receiving an error but because you're navigating away from the screen right away, you may be missing it.
That being said, remove the DateValue from around Blank() and try that.
Patch(
'LTRequest',
ThisItem,
{
SubmitDate: Blank(),
Status: "Draft",
ApprovalDate: Blank()
}
)
If that doesn't work, I'd try an Update() function:
Update(
'LTRequest',
ThisItem,
{
SubmitDate: Blank(),
Status: "Draft",
ApprovalDate: Blank()
}
)

Related

How can I use DAX and get Rank Function Working?

I am trying to follow the example here.
https://www.sumproduct.com/blog/article/power-pivot-principles/ppp-introducing-the-rankx-function
I created a table named 'MyRanks', which looks like this.
If I enter '=RANKX(MyRanks,[Total Sales])', nothing happens.
When I go to PowerPivot and Calculated Fields, then I enter '=RANKX(MyRanks,[Total Sales])', I get an error saying, 'The name you entered is not valid.'
Finally, when I select the table and click Calculated Fields and New Calculated Field, I get this error.
When I look at YouTube videos, it always works fine for people. When I try to do it, it never works for me. Not sure if something is not setup right, or what's going on here. Any guidance would be greatly appreciated.

SSRS: expand the ultimate group of values by default upon initial execution

Is there a way to get SSRS to expand the ultimate group of values by default upon initial execution, regardless of values?
My report looks like this:
Current scenario
What I want to achieve:
Ideal Scenario
I've searched for an answer without any success, I can't even find a similar question! Most require the current date values which can be done through the visibility settings and setting an expression to hide when not current date (or if not date then a specific value) - I get that. That's not what i'm asking, I simply want the ultimate values to be displayed when the report is initially rendered.
Any help is much appreciated. Thanks in advance!

Remove a button in SuiteScript

I need to be able to remove the delete button when today is greater than a particular calculated date.
There are 2 ideas I had and issues with each:
1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.
2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?
If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.
I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:
Save the value to a custom field - custbody_block_dlt_date
In a workflow, use the Remove Button function and use a formula condition
The condition is: {custbody_block_dlt_date} < sysdate
"sysdate" is the way you can get "Now()" or "today" in the condition
An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.
See nlobjButton for examples.

Alerting the user while creating field

I need an help in a formula for sharepoint.
I have created issue tracking ticket, all necessary fields are filled.
Now I have a field called "Request Close day". This field should be filled with date and time while closing the ticket. Now there is another field called "Ticket Status" which is choice type having values In progress, Waiting on customer and Closed.
Now the issue is when I set the "ticket status" as closed the field "Request Close day" should be filled.If a user forgets to fill in it should alert the user to fill the "Request Close day" or it should automatically fill the date and time.
Is it possible to alert the user using the IF or Vlookup condition.
Thank you all in advance..
I don't think there is a built in functionality for this.
But you could achieve this by adding the logic using Javascript inside a content editor webpart. Should be quite simple to attach the necessary events using
e.g. jQuery. something like:
$("id_of_ticketstatus").change(function(){
$("id_of_date").val(Date.getDate());
});

SharePoint: Calculated Column Values Disappear When Editing List Item. Any ideas?

I have a calculated column in a custom SharePoint 2007 list, with the following formula:
=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))
If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item.
So, on creation: "IR-40-TheTitleIsHere", but after edit, it is, "IR--TheTitleIsHere".
Anyone have some insight on why this would be happening?
I confirm the behavior mentioned above. Any Add/Edit will wipe out the [ID] portion. If you edit the column in the list and update the formula, it will update ALL list items to be correct (until you do an edit on the item).
I found this post that mentions the same problem.
Sounds like the only solution would be to make a simple workflow using SharePoint Designer that would update a text field in your list.
I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.
This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.
This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.
In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.
I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.
This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.
Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:
if (HTMLregexp.test(CellContent)) { //original pathtosharepoint line
if (NodeSet[i].parentNode.getAttribute("iid")){
var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
CellContent = CellContent.replace("SPIDReplace", SPID)
}
NodeSet[i].innerHTML = CellContent; //original pathtosharepoint line
This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010.
Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.
pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/
pathtosharepoint code: http://pathtosharepoint.com/Downloads

Resources