is this a valid search formula? CASE WHEN {call.co...
# suitescript
a
is this a valid search formula? CASE WHEN {call.completeddate} > {messages.messagedate} THEN {call.completeddate} ELSE {messages.messagedate} END
🤔 1
d
May you need convert {call.completeddate} into DATE with TO_DATE()... but, Its only thing I think.
a
@Diego Modesto thanks result field is a Formula (Date) how can I add text to the formula?
for example CASE WHEN {call.completeddate} > {messages.messagedate} THEN {call.completeddate} + 'Call' ELSE {messages.messagedate} + 'Message' END
is that possible?
d
IF entry in formula is DATE (call.competeddate) (I sayd about value result in SEARCH) this type need be the same
a
I want to compare all the dates
and find the latest one
if the latest one is a call print call date + 'Cal'
if that date is for a message print message date + 'Message'
is that possible?
b
general warning: searches with 2 joins tend to have duplicated rows
p
To concatenate use
||
or
concat()
a
@battk thanks what's the solution in this case I want to search for the customer messages and calls and find the latest one and print the data for the latest one
@PNJ thanks because field is formula(Date) I think I can't use that there is an error
b
Its a general warning
a
whit this formula
Copy code
CASE WHEN {call.completeddate} > {messages.messagedate} THEN {call.completeddate} ELSE {messages.messagedate} END
I was able to find out the latest communication date
but not the rest
b
You might be able to get away with it if you are only interested in the latest
a
yes I'm only interested in the latest one
b
You shouldnt be using a date formula if your output column is text
a
that's the issue when I want to use the text formula
I can't use Maximum summary to select the latest one
I'm using the formula + Maximum summary type + formula(date) field to be able to show the latest communication
if I want to use text I can't use Maximum
b
You probably want to use the max function instead
summary types are for displaying data
Dont use summary types for logic
a
something like this
Copy code
CASE WHEN MAX({call.completeddate}) > MAX({messagesto.messagedate}) THEN MAX({call.completeddate}) ELSE MAX({messagesto.messagedate}) END
without summary
?
it doesn't work with Formula(text) field
b
you would want to use the analytic form
a
analytic form?
b
look at the Analytic Example from the docs
a
I was trying to find out the example in the doc but, I can't see that
also at the end, I want to export that and use in code. can we do that with analytic form too?