Variable prompt based off another variable prompt - Dynamically update - obiee

I have two variable prompts containing dates (2013 / 01, 2013 / 02, etc...)
Prompt_Range1
Prompt_Range2
Prompt_Range1 goes back for historical data (1990's), up to the current date. Default is the current date (2014 / 07).
Prompt_Range2 goes from Prompt_Range1 up to the current date. Default is again the current date.
This is working on the initial page load, but I want to be able to change Prompt_Range1 to some past date and have Prompt_Range2 automatically update to include all dates between Prompt_Range1 and the current date after the page has loaded.
That is to say if I select 2012 / 05 for Prompt_Range1, then Prompt_Range2 will update to include the date ranges from 2012 / 05 to 2014 / 07. If I change Prompt_Range1 again, the dates in Prompt_Range2 should update accordingly. I don't want to click any buttons or otherwise complicate the issue for end users.
Is it possible to have dynamic prompt values like this?
Thanks.
*Edit - This is the SQL I am using to populate the end date.
SELECT "Date"."Month"
FROM "MySubjectArea"
WHERE "Date"."Month" BETWEEN '#{Prompt_Range1}' AND VALUEOF(CURRENT_MONTH)
ORDER BY 1 DESC
**Edit - Did not find a solution, went back to using prefilled dates. Not ideal but working and simple.

Yes. You'll need to use an SQL expression in the available values to return dates based on the first variable.
EDIT:
Ah yes - have you tried ticking the box that says the prompt should be based on the value of all prompts?

Related

Why selecting a date\time range into Kibana the query is performed with wrong dates? URL parameters are wrong

I am working on a project involving ElasticSearch and visualizing data on Kibana and I am finding the following problem with date range selection.
As you can see in the following picture I selected I time range that starts from April 8 2021 at 00:00:00.000 and end at April 10 2021 00:00:00.000 . Then I clicked the Refresh button in order to perform the query.
The problem is that, as you can see in the highligher URL section the passed date range into the query is wrong !!! Infact this is the timerange section of my query into my URL parameters:
time:(from:'2021-04-07T22:00:00.000Z',to:'2021-04-10T10:00:00.000Z')
As you can see it is pretty differnt from what I selected into the start and end date form fields.
Changing the values into the start and end date form fields automatically changes also the values into the URL parameters but they still wrong.
What could be the problem? Why selecting dates and time into these form fields the parameters value are wrong? What could be the cause of this issue? How can I try to fix it?
I suspect something related to the server timezone (the server where Elastic\Kibana) are installed or something related to some Kibana configuration but I really have no idea
The kibana docs specify:
The timezone that Kibana uses. The default value of Browser uses the timezone detected by the browser.
So (I'm assuming) your browser default timezone is UTC + 2, meaning when you select 00:00 it's converted to 22:00 UTC timezone, The Z in 2021-04-07T22:00:00.000Z is in indicator here.

Date Picker Validation Start Date

I am new to the environment and need help writing a validation statement in APEX.
I have a Start Date and End Date field on a page with a Date Picker Type.
The End Date validation has already been set ( end date must be equal to or greater than start date )
Now I need to implement this validation for start date:
User should be able to choose either the current date (today) or a future date.
Is there a way to disable previous days on Apex? Or would I need to write a validation statement? If so, what validation statement could I use?
Check out the settings for the date picker, specifically the minimum date.
Use the help to work out exactly what you need. APEX will then handle the validations for you.

how to solve no date entry above 2019 with out sysdate

As seen on above picture, I have one date entry field and one pick date button that opens calendar.
Now I want to set a trigger that prevents user from entering date greater than 01.01.2019 and raise error that
You cannot enter date greater than 01.01.2019
but I do not want to use system date as user can change system date and than enter data.
What do you mean by saying that "user can change system date"? This is Oracle Forms, right? SYSDATE returns the database server system date, not client (i.e. user's own PC) date, so - go on and use SYSDATE, no problem with that (unless, of course, users have access to the database server, but that's another story & a huge security hole).
By the way, apart from using a trigger (that would be the WHEN-VALIDATE-ITEM), a simpler way to do that is to open item's Property Palette and use the "Highest allowed value" property, set to today.

How did windows/c# remember the current systems year/date

Recently i was working with unit testing for my project.
I've given a task to test the method. The method should return the recent quarter date as per the current system date.
So, I've called the current system date using the following c# code:
string currentYear = DateTime.Now.ToString();
When i run the query it worked as expected.
So, its time for my tactics to raise a bug for that method. Hence I've changed the system date to 10/01/14 (dd/mm/yy).
Also I've customized current system date format to only keep last two digits of the year.
Ex: if year is 2014 the it shows only 14.
You can observe the short date and the long date in the following image.
When i run/debug the test in Visual Studio 2012, it still displays as 2014 as the current system date though I've modified it to 14.
Question: The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1914 or 1814 and why it is 2014 ?.
Where did it store the current date or year information ? Does windows manage this stuff or did the C# taken care of the date ?
The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1904 or 1804 and why it is 2014 ?.
C# only retrieved the date from the system, it was Windows that determined what data to send.
In the case of two-digit dates, Windows allows you to define what they mean in the Regional and Language applet in the Control Panel. This way you can specify the range you want it to represent depending on your usage.
The display of a date is not how it is stored, just how it is displayed.
January, 1st, 2014 may have a multitude of different formats, e.g.
2014-01-01
01-01-2014
01-01-14
1/1/14
Jan/1/14
001-2014
But all are held internally exactly the same way.
Note the advanced settings on your screenshot - this will indicate to many windows programs how to interpret a year entered as 2 digits, so it knows if it should regard a date entered as XX as 19XX or 20XX - this will cover manually entered dates, not the system date
Your C# application didn't store that date, Windows handled it for you.
As Sean mentioned, by changing from YYYY to YY you only changed how the date is displayed, not how it is stored. Windows doesn't store its system time information into a specific date format. Instead, it records the number of 100-milisecond intervals since 00:00 January 1st, 1601. That way it keeps the tracking of time independent of how it's displayed and allows you to display the date and time in a number of different formats.
As a curiosity, that specific date was chosen because the Gregorian calendar operates on a 400-year cycle (when it starts to repeat itself) and 1601 was the first year of the cycle that was active when Windows NT was being developed.
On a side note, Unix systems store that information as Unix Time or POSIX Time, counting the number of seconds elapsed since 00:00 January 1st 1970.

Need to set up a customised date range validator in Ruby On Rails

I have the following model which corresponds to teh following table:
PriceAvailability
ID| PRODUCT_ID| VALID_FROM|VALID_TO|PRICE
Basically the table stores prices of a particular product between a specific range of dates. Like a product may cost 10 dollars between 1st Jan 2012 to 3rd May2012 and 12 DOllars from 3rd of May to end of June etc. Thing is that I need to set up a validator that:
Ensures that each record has a date range that doesnt overlap or conflict with another date range for that specific product, i.e you canot have two rows that have a date ranges 1st of Jan 2012 - 1st March 2012 and 1st of Feb 2012 to 1st April 2012 respectively for product ID 1.
I got the idea of setting up validators and even set up a simple validator for the start date however I'm stuck with implemnting this kind of check. How can I do it?
let me know if this works for you:
validate :ensure_unique_date_ranges
def ensure_unique_date_ranges
date_ranges = (products.price_availabilities - [self]).map{ |pa| (pa.valid_from.to_i..pa.valid_to.to_i) }
self.errors[:base] << 'date range is invalid' if date_ranges.detect{ |dr| (dr.to_a & (valid_from.to_i..valid_to.to_i).to_a).empty? }
end
One thing to watch out for is date.to_i. If ranges are big then performance might go down. Try and see if it's acceptable.

Resources