Codeigniter calculate day, week, month, year from search - codeigniter

I am developing a job site, and the custumer would like the following.
On the job submit, the user will be able to set a date when the actual job will start, and in the search there are the following options for job start to select:
<option value="">Today</option>
<option value="">Tomorrow</option>
<option value="">In a week</option>
<option value="">In a month</option>
And im a bit lost at this part, i never did something like this.
Now i dont want anybody to write this for me, just give me an advice or a hint, for the logic, if its posible.
What i donr really get is, what values should i give the options, and how to get the actual reasults if there is.
Thank you

The values only need to be ones you'll recognize when processing the request. They could be "today", "tomorrow", "next_week" and "next_month" if you want.
Then when handling the request, take today's date and add:
nothing (today)
one day (tomorrow)
seven days (in a week)
one month (in a month)
Look at DateTime::add for the date arithmetic part.

I would like to add one thing only.
Replace the value attribute of Option tag. For example
Today
Then handle the request through server. This is very nice logic to implement and its rather easy.

Related

Avoid #VALUE! on empty cells when using GOOGLETRANSLATE function

The idea is to enter a date in USA format (MM/DD) and it will automatically show the day of the week in spanish in another cell using code =googletranslate(TEXT(B9, "dddd"),"en", "es")
The thing is that empty cells are showing #VALUE!. How do I avoid this?
When using code =TEXT(B15, "dddd"), that doesnt happen, but it shows day of the week in english.
Because im using googlesheets, using code =TEXT(B22, "[$-0C0A]dddd") doesnt work to translate language.
=if(B9="","", googletranslate(TEXT(B9, "dddd"),"en", "es"))

User facing date field granularity control

I'm trying to give my users the option to select the date field granularity of their choice, such as day, week, month or year. This is normally controlled on each graph in the menu show below but this isn't available in a published dashboard:
My first idea was to create a calculated field that truncates my desired date based on a parameter that I expose through a control. This would like something like this, truncDate(${intervalParameter}, {dateColumn}). The problem with this is that the first argument of the truncDate function must one of valid string literals and will throw an error before saving if it isn't.
Does anyone know of any other ways of achieving this? Or maybe some sneaky way of getting around the error?
I figured out a work around using ifElse.
ifElse(
${intervalParameter} = 'Day', truncDate("DD", {dateColumn}),
${intervalParameter} = 'Week', truncDate("WK", {dateColumn}),
${intervalParameter} = 'Month', truncDate("MM", {dateColumn}),
truncDate("DD", {dateColumn})
)
There might be better solutions out there but this is what I've come up with.

Possible to have a simple formula within the [value_if] argument? - excel

I'm trying to use a relatively basic IF function but having no luck - i'm sure i just have brackets or parenthesis wrong or something. Reckon it will be childsplay for you guys....
The formula is intended to show how many days a date has passed by. Date is shown in T column.
Basically it was working fine as the following, both for pending and past dates:
=IF(T7<=TODAY(), (TODAY()-T7),-(T7-TODAY()))
But I got greedy and wanted it to return more of a statement when the date has passed, as to how much it has passed by. So I've tried to make this happen with:
=IF(T7<=TODAY(),"EffOut(TODAY()-T7) days ago",-(T7-TODAY()))
Hoping it would enter "EffOut 8 days ago" (when TODAY()-T7 is 8 days) for example.
But it doesnt - it shows the entire argument i.e "EffOut(TODAY()-T7) days ago" in the return cell.
Is it possible to have a kind of embedded formula in the 'value_if' fields, mixed with text in this sense?
Happy to share the document if that would help, but will need to clear the data first so just let me know.
Thanks in advance, any help is much appreciated! Having read other posts I think it will just be a simple fix but its well beyond me! (I only got this far by perusing forums...)
Maybe something like this...
=IF(T7<=TODAY(),"EffOut "&DAYS(TODAY(),T7)&" days ago",-(T7-TODAY()))
=IF(T7<=TODAY(),"EffOut "&(TODAY()-T7)&" days ago",-(T7-TODAY()))
You just need to be careful to put "" around any strings. This is how Excel knows that's not a part of the formula. Remember to out the spaces is to the string like I did above so it looks like a sentence. The & sign combines the results of the calculated parts and the strings.

How do I select an item from a drop down with Site Prism?

I have the following elements defined within a SitePrism page:
element :type, "select[id='type']"
elements :type_options, "select[id='type'] option"
And in my cucumber step definitions I have the following code to select an item from the select box based on the elements value:
#app.new.type_options.each {|name| name.click if name.text.upcase == value.upcase}
I don't really like this implementation but it does work perfectly when running Capybara in chrome but fails when I run it headless so I figure there must be an alternate / better way to select drop down items.
Ideally I'd like to be able to do something like #app.new_r.r_type.select 'value', but I can't work out how to do this in SitePrism.
So, my first question is, can anyone recommend an elegant way to select an item from a drop down based on value from SitePrism?
And my second question is, any idea why the above code fails when running headless?
I had a similar problem, where I couldn't get it to select the option I wanted. I came across this question and it made me realize my problem was that you have to send the text, not the value, to the select().
For example, if I have HTML like
<select id="things">
<option value="thing1">The First Thing</option>
<option value="thing2">The Second Thing</option>
<option value="thing3">The Third Thing</option>
</select>
And in my SitePrism::Page class I have:
element :things, "select[id='things']"
I thought I needed to do:
#my_page.things.select("thing1")
That does not work. Instead you have to do:
#my_page.things.select("The First Thing")
I know this is slightly different than trying to select based on a value you get from SitePrism, like was originally asked. But I thought this distinction about what to pass to select() might help someone.

Validate Start Time With Current Date In Sharepoint?

I have a column called Start Time (it's a SharePoint Default Calendar Column). I need to validate if the Start Time is less than today or not? Without using javascript? Is this possible?
I have tried this:
Created a column called Today type as Date and Time.
Default value is current date.
Then compared the Start Time and Today in validation settings like the following:
=[Start Time] < [Today]
it seems not working. help please?
Try this code instead of yours
=[Start Time]<NOW()
I use this to validate that Start Date must be less than or equal to Today:
=[Start Date]<=Today()
...and it works for me.

Resources