I want my code to display nothing if it doesn't have a date.
Here is my code:
=format(IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection", Fields!PreFeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition", Fields!FeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Implementation", Fields!ImplementationCurrentTargetDate.Value, ""))), "dd-MMM-yy")
Because I am formatting it to dd-MMM-yy, it displays that when the item doesn't have a date. How can i have this changed to display nothing if it doesn't have a date.
Change the blank values of your expression to nothing
=Iif(Fields!Phase.Value="Operation","-", format(
IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection",
Fields!PreFeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition",
Fields!FeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Implementation",
Fields!ImplementationCurrentTargetDate.Value, Nothing)))
, "dd-MMM-yy") )
I would also advice you to use the field format property instead of the format function inside the value expression. In this case it works even if the field value is blank
check the MSDN form here,
https://msdn.microsoft.com/en-us/library/ms157406.aspx
it clearly mention that "If you specify an invalid format string, the formatted text is interpreted as a literal string which overrides the formatting."
So. you need to check the string after formatting,
IIF(output="dd-MMM-yy","",output)
Related
I have read many questions on stackoverflow and didn't get what I want. I have a String with value: "1.000,00" and I want to make it a double and look exactly like this "1000.0" but I can't do it right. Using the code below, I just get "1.0" and this is incorrect. How to do this in the right way? I am using Flutter.
String t = "1.000,00";
double f = NumberFormat().parse(t);
userIncome = f;
You just need to set the defaultLocale property.
Intl.defaultLocale = 'pt_BR';
String t = "1.000,00";
double f = NumberFormat().parse(t);
print(f); // Prints 1000.0
In your case, is not just a "number", is a currency.
A simple way to deal with it is to convert into a number and parse:
String t = "1.000,00";
// the order of replaces here is important
String formated = t.replace(".", "").replace(",", ".");
userIncome = Double.valueOf(formated);
But, if your application is focus on currency you should take a look in this:
https://www.baeldung.com/java-money-and-currency
I'm trying to send a mail via the powermail extension to different receivers, depending on the value a user has selected in a form dropdown. This practice of dynamic receivers is described in the powermail documentation. Basically:
receivers1.email = CASE
receivers1.email {
key.data = GP:tx_powermail_pi1|field|receiver
1 = TEXT
1.value = receivera#domain.org
default = TEXT
default.value = receiverb#domain.org
}
Now I'm facing the following problem: my values for "receiver" are not numeric (as in the example), but text values from a dropdown. Some of them contain spaces, some of them contain umlauts (öäüß). If I try to add …
Not wörking = TEXT
Not wörking.value = anotheremail#nowhere.org
Typo3 will complain and not update anything. (Bad property!
You must enter a property with characters a-z, A-Z and 0-9, no spaces!Nothing was updated!)
I tried simply 'escaping' the forbidden characters with a backslash, not working. Had an idea of converting the key.data via stdWrap rawUrlEncode, but did not work either. Google came up with this solution, but I don't understand what's going on and could not use it successfully.
How can I get around this? Thanks a lot for any kind of hint!
I pretty like your rawUrlEncode solution. Can you provide us your solution of it here? According to this online converter the result should be something like:
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.rawUrlEncode = 1
Not%20w%C3%B6rking = TEXT
Not%20w%C3%B6rking.value = anotheremail#nowhere.org
Maybe for each CASE some signs like "%" are not allowed. In that case you maybe refer to the "replacement" function. https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Replacement/Index.html#replacement
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.replacement {
10 {
search.char = 32
replace = _
}
// Add umlauts and other signs!
}
Not_wörking = TEXT
Not_wörking.value = anotheremail#nowhere.org
I use the following to read hidden text.
Globals.ThisAddIn.Application.ActiveDocument.Content.TextRetrievalMode.IncludeHiddenText = true;
var Text = Globals.ThisAddIn.Application.ActiveDocument.Content.Text;
But it doesn't return hidden text. Moreover, if I check TextRetrievalMode.IncludeHiddenText, it's still false - my statement is ignored but it doesn't throw any exception.
How to read hidden text please ?
Accessing the text retrieval mode like in your sample will always return a fresh Range object with the default configuration. You need to get a range object, set the TextRetrievalMode on that object and then get the text from that same object:
var range = Globals.ThisAddIn.Application.ActiveDocument.Range();
range.TextRetrievalMode.IncludeHiddenText = true;
var text = range.Text;
In a view panel, I have one col that is displayed as HTML because I am pointing to documents created with a traditional form. So, I can't set the "Display type" to anything except a String. I've tried to convert the value by using toJavaDate, but that didn't work.
Here is the formula for my HTML column where rowData is the var or view panel. myserver/folder/myapp.nsf part I changed so that I could paste it here...
if (!rowData.isCategory())
var disp = rowData.getColumnValue("PayPeriod");
"<a href='https://myserver/folder/myapp.nsf/0/"+rowData.getUniversalID()+"?OpenDocument'>"
+disp+"</a>"
The link works properly in my view, but the value displayed shows a full date & time value (6/15/13 8:51 AM). All I am trying to do is display it as 06/15/2013 (MM/DD/YYYY)
if the column is set to date you could use this to get the correct date format
if (!rowData.isCategory())
var formatter
if(viewScope.formatter){
formatter=viewScope.formatter
}else{
formatter = new java.text.SimpleDateFormat( "MM/dd/yyyy" );
viewScope.formatter=formatter
}
var d = rowData.getColumnValue("PayPeriod");
var disp=formatter.format(d)
"<a href='https://myserver/folder/myapp.nsf/0/"+rowData.getUniversalID()+"?OpenDocument'>"
+disp+"</a>"
What should i do ?
$edit_end_date = '2011-02-31';
$validator_date = new Zend_Validate_Date(array('format' => 'yyyy-mm-dd'));
$isval = $validator_date->isValid($edit_end_date);
if((!$isval) || empty($edit_end_date))
{
echo "Please Enter Valid End Date. !";
}else{
echo "Entered Is Valid End Date. !";
}
how come it returns true date ?
According to the Zend API Docs, it appears that Zend_Validate_Date will only validate whether the argument passed to it, is a valid date construct (also considers locale), it will not validate if the date actually exists.
Zend_Validate_Date allows you to validate if a given value contains a date. This validator validates also localized input.
-- Edit --
Looks like you can use PHP's built in checkdate() function to determine if a date is valid or not.
There are bugs in data validation (ZF-7583 at issue tracker). Look at Zend_Validate_Date just doesn't work properly
You can use regex validation like in answer to linked question, but it will only check for syntax, not if date exists for real. For this you can use checkdate() - as Mike Purcell suggested - combined with Zend_Validate_Callback:
$validator1 = new Zend_Validate_Regex(
array('pattern' => '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/')
);
$validator1->setMessage(
"Date does not match the format 'yyyy-mm-dd'",
Zend_Validate_Regex::NOT_MATCH
);
$validator2 = new Zend_Validate_Callback(function($value)) {
// using checkdate() or other function
});