How to provide whitespace between a displayed Icon and Data in a Datatables Ajax table column field - ajax

In one of my controllers, I have an Ajax Datatables process generating a table as my index function. In this process in one of my date columns, I have added logic that displays an icon beside the date if the date is today's date or past date, but if it is a future date then it just displays the date.
$table->editColumn('followup_date', function ($row) {
// check to see if record is todays date or older, if so display Bell icon next to date
$date = Carbon::parse($row->followup_date);
$today = Carbon::now();
if ( $today > $date ) {
return $row->followup_date ? (true ? ' <i class="fas fa-bell-exclamation red"></i>' : '') . $row->followup_date : '';
} else {
return $row->followup_date ? (false ? ' <i class="fas fa-bell-exclamation red"></i>' : '') . $row->followup_date : '';
}
});
This works grand, however, the icon displays in the table column field right beside the date data without a space between. Such as 'IconDate' and I want it displayed as 'Icon Date'. How does one successfully inject a space between the icon and the date in this return statement?
My thought was something to do with '&nbsp' however I have not found a successful way to implement it in the code. I'm sure I am missing something simple but all my attempts at added the space between icon and date have failed.
In response to AndrewJames with regard to what I had tried. I had been thinking that I needed to insert the space between the two elements, icon and date. So I had explored different ways to try and use   in some manner to the lsft of ) and before the $. Such as ) . $row OR ) . $row OR ) . . $row and a bunch of other options.

Based on some of the questions Andrewjames asked me, it got me thinking that rather than add the whitespace between the two elements maybe the answer lay with attaching the whitespace to one of the elements. That seems to the thought I needed. The answer is to add the whitespace inside the ( ) attached to the element:
return $row->followup_date ? (true ? ' <i class="fas fa-bell-exclamation red"></i> ' : '' ) . $row->followup_date : '';
This provides the whitespace between the icon and the date when displayed in the table.

Related

Filter Recent date in filter

I want the Slicer in Power BI to select the most recent date of the selection to be selected automatically.
Here is an example of the drop down:
https://i.imgur.com/IykHSlI.png
This drop down differs from the Client selection.
I solved this issue the following way:
I created one Report with a filter to Default_Date (which opens first)
I used a Calculated Column [Default_Date] to populate the filter (which is hidden)
In my case the user wanted to see Yesterday's data as the default date so I selected 'Yesterday' on my filter.
Then I put a button that opens another duplicated copy of the Report [Hidden Tab] that contains a full calendar filter, so the user can select any other dates he likes, this hidden report has another button that returns the user to the main report [if he wants to].
picture of my filter (which I collapse and hide under a color box/banner)
Here is the formula for the calculated column (used in the filter):
Default_Date =
VAR TodaysDate =
TODAY()
VAR YesterdayDate =
TODAY() - 1
VAR reportDate =
SWITCH(TRUE(),
'Calendar'[Date] = TodaysDate, "Today",
'Calendar'[Date] = YesterdayDate, "Yesterday",
"Before Yesterday"
)
RETURN
reportDate
Use Default_Date in your filter, and you can replace TODAY() with
CALCULATE(Max(Table[Date]),All(Table))
and remove what you don't need.
If you want to get the Last Date of selected items, then
CALCULATE(Max(Table[Date]),ALLSELECTED(Table))
Table may need to be in quotes to work: 'Table'[Date]
I hope this helps.
There isn't to set a default value in Power BI, but there are a few around about ways. First you can try Persistent Filters that can preserve the filters selected. The other option, is to create in your data set, if you have a calendar table, or are able to add it to your column a current date flag, that you can apply as a filter to your report.
For example you can use the TODAY() to return todays date, and check against your date column.
Calculated column = IF(MONTH(TODAY()) = MONTH('table'[DateColumn]) && YEAR(TODAY()) = YEAR('table'[DateColumn]), "Y", "N")
You can run the report and it will always filter on the latest date, however you will have to remove the filter if you want to see other dates. You could set up bookmarks so that you can easily add/remove filter to the report. So you would have one bookmark with latest date, and the other to remove it. You can allow the slicer box to appear when you select the 'remove current month' bookmark
Hope that helps

APEX Office print

I am currently working with the Apex Office Print it would be nice if you could help me with two points.
I am creating a template with a lot of fields, and around 50% of
these fields are optional, so they are often only (null) in my
database. Can I do something so that the fields with no value are not
shown?
My second question would be the work with the print function and
checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so
that I only print the content of a selected checkbox ? It is not
really working in the PL/SQL section.
I am creating a template with a lot of fields, and around 50% of these fields are optional, so they are often only (null) in my database. Can I do something so that the fields with no value are not shown?
The {tag} will just be removed when it's empty. In case you want to make some blocks disappear you can wrap that in a condition,
for example:
{#tags=null} {product_name}: {product_description} {/tags=null} {#tags!=null} {product_name}: {tags} {/tags!=null}
or if you have a value:
{#checked=="Yes"}☒Yes ☐No{/checked=="Yes"}{#checked!="Yes"} ☐Yes ☒No {/checked!="Yes"}
My second question would be the work with the print function and checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so that I only print the content of a selected checkbox ? It is not really working in the PL/SQL section.
Are you running the AOP Process type plugin or the Dynamic Action plugin?
For example we use it for ourself when selecting invoices and printing them.
We have a checkbox in an IR:
apex_item.checkbox2(
p_idx => 1,
p_value => id,
p_attributes => 'class="invoice_id"',
p_checked_values => :P39_INVOICE_ID_LIST,
p_checked_values_delimiter => ',') as chk,
And then we have a Dynamic Action on change that sets an hidden item (P39_INVOICE_ID_LIST) on the page:
var
//Checkbox that was changed
$checkBox = $(this.triggeringElement),
//DOM object for APEX Item that holds list.
apexItemIDList = apex.item(this.affectedElements.get(0)),
//Convert comma list into an array or blank array
//Note: Not sure about the "?" syntax see: http://www.talkapex.com/2009/07/javascript-if-else.html
ids = apexItemIDList.getValue().length === 0 ? [] : apexItemIDList.getValue().split(','),
//Index of current ID. If it's not in array, value will be -1
idIndex = ids.indexOf($checkBox.val())
;
//If box is checked and it doesn't already exist in list
if ($checkBox.is(':checked') && idIndex < 0) {
ids.push($checkBox.val());
}
//If box is unchecked and it exists in list
else if (!$checkBox.is(':checked') && idIndex >= 0){
ids.splice(idIndex, 1);
}
//Convert array back to comma delimited list
apexItemIDList.setValue(ids.join(','));
In our query in the AOP DA we have:
where i.id in (select regexp_substr(:P39_INVOICE_ID_LIST,'[^,]+', 1, level) invoice_id
from dual
connect by regexp_substr(:P39_INVOICE_ID_LIST, '[^,]+', 1, level) is not null)
and we make sure the P39_INVOICE_ID_LIST is set in session state by specifying the Affected Elements of the AOP plugin call.
If you setup an example of what you want to do on apex.oracle.com I'm happy to build you the example there. In AOP 4.0 we will also include an example with checkboxes.
Hope that helps,
Dimitri

Validation of date input fields in React

i have to date input fields which i defined like this:
const MyDatePicker = ({ input, meta: { touched, error } }) => (
<div>
<DatePicker
{...input} dateFormat="DD-MM-YYYY"
selected={input.value ? moment(input.value, 'DD-MM-YYYY') : null}
/>
{touched && error && <span>{error}</span>}
</div>
);
I use redux form for this. I want to add a validation with the following functionality. When the date in the "Date To Field" is lesser than the date in the "Date From" field a message will be shown that the date to field must me greater that the date from field. As you can see my date format is for example: 06-03-2017. The more "challenging" part is that in another component the date From and date To must have a time space of year. If the time space is more than a year a message should be appeared the the time space must be of a year at max
The synchronous validation function in Redux Form is given all of the form values. It seems like it would be pretty easy to say:
if(values.to.before(values.from) {
errors.from = 'Must be before'
}
Alternatively, if you are doing "field-level" validation, the second parameter to the validate function is all the values of the form.

Need to know Joomla Session timer data type

I have been looking under database of joomla. There I found under gu94g_session table, time column which is having value 1377499731. What does it mean. how I can decode this time. Would appreciate help.
The time column contains the Unix timestamp at the time of the records creation.
In Joomla! 2.5+ and 3.x+ the time column of #__session is set to value returned by PHP's time() i.e. the current Unix timestamp.
When sessions are stored in the database, the /libraries/joomla/sessions/storage/database.php file creates a record using this SQL query:
$query = $db->getQuery(true)
->update($db->quoteName('#__session'))
->set($db->quoteName('data') . ' = ' . $db->quote($data))
->set($db->quoteName('time') . ' = ' . $db->quote((int) time()))
->where($db->quoteName('session_id') . ' = ' . $db->quote($id));
The time is set with this line:
->set($db->quoteName('time') . ' = ' . $db->quote((int) time()))
Its time stamp value of the current date time.
When the user get logged in in the site front end or back end a corresponding session is created with their login time like strtotime(date("Y-m-d h:i:s")) and save that on the time column Then based on the back end value its check expiry and clear session.
I think now its clear for you..

Google spreadsheet xpath only selects arrays instead of single values

So I am trying to use this bit of code to only select a single show from a show database, I only want the latest selected show, but google spreadsheet keeps returning an array of the lastest show from every season.
=importXML("http://services.tvrage.com/feeds/episode_list.php?sid="&B2, "//episode[number(translate(airdate, '-', '')) < "&I2&"][last()]")
B2 is the show id = 11215 and I2 is the today's date in iso style format = 20130626 this date is acquired from google spreadsheet with the command =TEXT( TODAY() ; "yyyyMMdd" )
So can anyone help me get just the latest show for the current season?
Put parentheses around the first path of your XPath expression:
(//episode[number(translate(airdate, '-', '')) < "&I2&"])[last()]

Resources