Setting the value of prompt to current date - sql

How do you possibly set the value of a prompt(date) to the current date when the user does not input any value? I always get invalid datatype error no matter what I do. :(
This is my prompt:
Maybe my format is wrong but I have tried, NVL, setting default value on prompt settings and always get the same error.

Try entering %Date as the default value.
It should populate the prompt with the current date when the query is executed.
You will also need to uncheck the "optional" flag, as a prompt with a default value cannot be optional.

On the criteria, you should define an expression as a decode (since you are on oracle), like this:
EFFDT = DECODE(:3,' ', SYSDATE,:3)

Related

How do I get the right date format after using get text on the folder date?

I have tried everything that I can think of to get the right date format. Can anybody help with this RPA-problem in UiPath. I have used the 'get text' activity to get the folder date and after that tried to use the
Datetime.ParseExact(Str variable,"dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).
It gives me the error:
Assign: String was not recognized as a valid DateTime.
Your help is much appreciated.
edit: I have now sought help from a friend who figured it out. The error was in the string, which could not be seen, because there was an invisible character in the string that I extracted through 'get text' activity. The solution is in 2 steps:
assign another variable to the exact same date and use an if statement to find out if these two strings are equal and you will find out that they are not.
Now use a regex to capture only digits and slash/hyphen which will get rid of the invisible character.
Try to use "dd_MM_yyyy" instead of "dd/MM/yyyy".
The reason is because UiPath/VB.Net has a habit of using US date formatting even though you're using Culture Info...It's a real pain
Try this:
pDateString = "21/02/2020"
Assign a Date type variable = Date.ParseExact(pDateString,"dd/MM/yyyy",nothing)
Here we're telling the parser to use English format date...The Date type returned will be in US format but you can simply convert back to uk IF needed by using something like:
pDateString("dd/MM/yyyy")

PSQL: Syntax error when passing set date variable into datetime

I'm working server-side (using SSH) in psql, where I set variables using the '\set' command.
My concern is this: I have a query where I'm inserting a set string (date) into a datetime, but I get thrown a syntax error.
Simple example:
SELECT
network_no,
program_no,
national_datetime.
FROM
views
WHERE
national_datetime
between ':from_date 06:00:00'
and ':to_date 05:59:59'::timestamp + '1 day'::interval
Where 'from_date' and 'to_date' have been set accordingly:
\set from_date 2017-07-10
\set to_date 2017-07-16
I know normally with dates you're supposed to set three sets of apostrophes to read it in correctly (I never looked up the reason), but I'm feeding this date into a datetime, so I figured using no apostrophes would work, but I get thrown this error:
ERROR: invalid input syntax for type timestamp: ":from_date 06:00:00"
LINE 40: between ':from_date 06:00:00'
Normally in a bash script this would work since it just passes the literal string value, but in this case, whether I put no or one set of apostrophes around the date values it won't pass the value (I'm assuming because of the way PSQL handles set variables.
I know there's ways around this, but I'm looking for a reason why something like this would be happening, and whether there's a simple way to fix the "invalid input syntax"--whether it be through casting a variable, setting the variable differently, etc.
Many thanks in advance!
:from_date is a variable that is not a string.
Here is a way to do it:
date :from_date + time ' 06:00:00'
see doc at https://www.postgresql.org/docs/9.2/static/functions-datetime.html

Why does SSRS Independent parameter is cascading by default

I have a report which currently has four parameters
1) BatchID
2) ProductName (dropdown parameter populated based on the batch ID)
3) StartDateTime (Date/time parameter with default value set to =Now)
4) EndDateTime (Date/time parameter with default value set to =Now)
When I run the report the StartDateTime and EndDateTime are greyed out why? As they are independent parameters I would have thought it will be enabled by default.
The next question I have is the delay, after entering the first parameter the second parameter is populated as expected. However after selecting the second parameter from the dropdown. There is a delay of over 30 seconds to populate the StartDateTime and EndDateTime parameter(s) with the current datetime.
I don't know if I did a good job in explaining my question. Any help.
Note that the problem of having a disabled date type of parameter for SSRS only occurs when the date/time parameter’s default value is an expression like =Now. If the default value is not set or is set to a literal value like 1/1/2018, the control functions as expected — it is enabled.
"Parameter order is important when you want to show users the default value for one parameter before they choose values for other parameters"
Ref:http://msdn.microsoft.com/en-us/library/cc281392.aspx
The controls after non-default parameters are disabled the user picks something, so order is important. The date/time control won’t be enabled until it evaluates its default value expression. It is stated that the delay you mentioned here is intended to allow this parameter’s expression to use the proceeding parameter’s value in its computation.
Ref2: https://bengribaudo.com/blog/2011/03/02/595/ssrs-datetime-parameter-disabled-when-default-value-expression-is-used

display warning when users enter a value greater than the actual value

can anyone give me some idea how to write a code to display warning when users enter a value greater than the actual value, but it still can enter values ​​for other fields. I use VB.net and access database. I think it is able to use onchange but i still don't have any idea to write the code
here is example
Use the built-in validation scheme. Example here :
http://msdn.microsoft.com/en-us/library/system.windows.data.binding.validatesondataerrors.aspx

VB.Net is my issue with DataRow.IsNull or Format(datetimevalue,"T")?

I am working on a new ASP.Net 4.0 data driven app. In the DAL I check for NULL values on all my data and default to the proper data when NULL. I have a strange issue going on. Two dates are coming back - on one I need the time only. The First line of code for the full date works without fail - but the second line of code errors pointing to the format string but the strange part is that it errors on NULL values which does not use the format string and just returns Date.MinValue. When the second line gets data it formats the return correctly.
Dim dr As DataRow
.TourDate = IIf(dr.IsNull("tourdate"), Date.MinValue, Format(dr("tourdate"), "MM/dd/yyyy"))
.TourTime = IIf(dr.IsNull("tourtime"), Date.MinValue, Format(dr("tourtime"), "T"))
The error comes on the second line when dr("tourtime") is NULL - the erroe is: Argument 'Expression' is not a valid value.
IIf in VB.Net does not do short-circuit evaluation, so the Format call is being executed even if the value is null.
You need to use If:
.TourTime = If(dr.IsNull("tourtime"), Date.MinValue, Format(dr("tourtime"), "T"))
This is the same issue described here: Using VB.NET IIF I get NullReferenceException
To trouble-shoot this, I would inspect the actual value stored. A datetime column that appears to be null may actually have a value.
I think you should use IsDbNull instead of IsNull.