IBM ODM : Verbalization for boolean functions in XOM - ibm-odm

I am new to ODM and I was trying to play around with verbalization. I have a question here.
Suppose there is a String field “discountDate” in my XOM and I need to write a rule like
if the discount date of sale is{not} having date format "dd/mm/yyyy"
then {do something}
To write such kind of rule how should my verbalization be? This is my XOM class : -
The respective Verbalization which I have given in BOM is :-
My question here is that for the verbalization I am able to only give a Positive verbalization here like “{0} is having date format {1}”. Instead of giving an else condition in the Rule is there any way to give verbalization like ““{0} is not having date format {1}”
Do we need to write two separate function in the XOM one that returns true by default for that a positive verbalization and one that returns negative for that a negative verbalization?? Or is there any other better way to do this??

It's a little clunky, but you can write the condition in the rule as:
it is not true that the discount date of sale is having date format "dd/mm/yyyy"

Related

Iferror in case of negative date doesn't apply in excell

I have two date like this:
In case of negative time-error ,I want to subtract them reverse but it doesn't work correctly.
It's not an error, when you have a negative time or it's to long, Excel show this information like this (############).
In that case it's better use a normal condition like this:
=If(D5-D6<0; D6-D5; D5-D6)
In this case you have a correct result.

Power Automate - Compare StartDate to current date?

We are looking to compare the calendar start date with the current date in flow. Currently we are pulling the start date through a filter query like this:
formatDateTime('EventDate','M-d-yyy hh:mm')
and comparing to this:
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I am getting this error currently: "Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '17987': 'In function 'formatDateTime', the value provided for date time string 'EventDate' was not valid. The datetime string must match ISO 8601 format."
Any help on this would be greatly appreciated!
You could Initialize a variable like the following below and then do a IF condition.
#{add(div(sub(ticks(utcNow()),ticks('1900-01-01')),864000000000),2)}
I test with the same formula to convert event start date and it works fine in my end. The if condition returns correct result on different conditions.
Here is the logic of my demo flow, please have a check:
I use get item to get the start date of a certain event in the calendar list and convert the start time dynamic content to the format I need. Almost same with yours.
According to the error message, it seems the format of the event date column is not in the supported format. Would you like to provide the settings of your event date column? I test with the default start time column and a custom date & time column of default settings. Both of them works fine with the flow above.
Update:
The two formulas used are displayed below:
formatDateTime(outputs('Get_item')?['body/Event_x0020_Date'],'M-d-yyy hh:mm')
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I just directly use the outputs of the data compose action in the if condition
What worked for me was to build a sequence of numbers with the dates being ordered by day, month and year this way, when converting to integer, it's easy to compare
int(formatDateTime(utcNow()),'yyyyMMdd'))
if you need add day for exemple, you can use
int(formatDateTime(addDays(utcNow(),variables('extraDays')),'yyyyMMdd'))
and the other date like this
int(formatDateTime(variables('FinalDate'),'yyyyMMdd'))
Based on your example, you can put hours and minutes without any problems, just remove the special characters and spaces
but by the definition of the error you are having, I believe it is because of the way you are writing the variable

How to verify that a value is a valid date in livecode

I am after a code to check the content of a field in livecode and determine if this value is a date or time value.
Beyond what Mark implied, the fact that "123456" being a date might break the intent of your handler, and what you already know, that there are several date formats, you may also want to validate the user input at a lower level.
What I mean is that if I were writing a validation routine, I would NOT permit "123456", considering this a data entry error. So you will probably want to test the format of the string itself, making sure it "appears" to be a valid date, as well as actually being a valid date.
If you want to use the local date format, you need to set the useSystemDate to true.
set the useSystemDate to true
put "123456" into myDate
put (myDate is a date and myDate is not an integer)
put ("12/12/15" is a date and myDate is not an integer)
However, sometimes this may not be what you want. If you provide more specifics, I might be able to come up with a better solution.

Format a date like "20110822" in Google Open Refine (or Excel)?

I have a dataset that has two different date formats in the same column. Some are formatted like:
2008-05-15T00:00:00Z
and others are formatted like:
20090804
Google Open Refine will recognize the first type as a date and will sort and allow me to perform other operations on it. I can't figure out how to format the second type into a date. A transformation of:
value.toDate()
throws an error, as does most everything else I try. This seems like a simple problem but Googling is not helping.
Hope it helps (might not!) but with 20090804 in A1:
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))
should return a value formatted as a recognisable date.
Might be wrapped in a condition like so:
=IF(LEN(A1=8),DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)),A1)
such that either the first format is returned or the alternative version, according to requirement.

AddDays function on attribute

I am new to Microstrategy and I having one doubt. I am trying to display amount sales of sales corresponding to DayDt(date type attribute ) and amount of sales for (DayDt-365 days).
I tried to use AddDays function but it seems directly I can't apply it on this attribute .It support only metrics.So I created a metric(DayDt Metric) based on the sum(DayDt).
But the value coming in the DayDt Metric Column is integer .how can I convert this value into date.
Also : I would be pretty grateful if anyone can tell any other procedure to achieve my purpose
Thanks in advance
In this case what you need is a Transformation.
Create a new transformation based on the DayDt attribute and as Expression use DayDt Id - 365 days (I'm not in front of MicroStrategy now, but you should be able to use formulas here, so AddDays or a similar one will help you).
Save the transformation with a meaningful name like "Last Year"
Make a copy of your orignal metric, but in the trasformation section add the Last Year traansformatio you just created.
Save it as "Amount of Sales (LY)" or the name that you prefer.

Resources