Converting Crystal to Stimulsoft

Stimulsoft Reports.WEB discussion
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Converting Crystal to Stimulsoft

Post by dwabare92 »

We are migrating over to Stimulsoft and I am working on learning the syntax.

Could I get some help converting this Crystal Syntax?

if {CustCode.CustCode} startswith "L-3" and (today-{OrderDet.User_Date2}) < 180 then "Short Life Material" else
if {CustCode.CustCode} startswith "HARR" and (today-{OrderDet.User_Date2}) < 180 then "Short Life Material" else
if {Estim.ProdCode} startswith "NITROG" then "NITROGEN CONTROLLED - DO NOT OPEN" ELSE ""
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Converting Crystal to Stimulsoft

Post by Lech Kulikowski »

Hello,

Please check the following expression:

Code: Select all

{IIF((Left(CustCode.CustCode, 3) == "L-3" && DateDiff(Today, OrderDet.User_Date2).Days < 180), "Short Life Material", 
IIF((Left(CustCode.CustCode, 4) == "HARR" && DateDiff(Today, OrderDet.User_Date2).Days < 180), "Short Life Material",
IIF(Left(Estim.ProdCode,6) == "NITROG", "NITROGEN CONTROLLED - DO NOT OPEN", "")))}
Thank you.
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Re: Converting Crystal to Stimulsoft

Post by dwabare92 »

Lech, this works great! Thank you so much!
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Re: Converting Crystal to Stimulsoft

Post by dwabare92 »

Lech, any chance you could take a whack at this? Aleksey wasn't sure with the DateDiff and DateAdd functions

ToText(DateDiff('d',currentdate+0,{DateAdd('m',{ToNumber({Estim.User_Text2})},{OrderDet.User_Date1})}) / (DateDiff('d',{OrderDet.User_Date1},{DateAdd('m',{ToNumber({Estim.User_Text2})},{OrderDet.User_Date1})})*100))
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Converting Crystal to Stimulsoft

Post by Lech Kulikowski »

Hello,

Please check the following expression:

Code: Select all

{(DateDiff(Today, OrderDet.User_Date1.AddMonths(Estim.User_Text2)).Days / 
(DateDiff(OrderDet.User_Date1, OrderDet.User_Date1.AddMonths(Estim.User_Text2)).Days * 1000)).ToString()}
Thank you.
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Re: Converting Crystal to Stimulsoft

Post by dwabare92 »

I will give it a shot. Thank you
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Converting Crystal to Stimulsoft

Post by Lech Kulikowski »

Hello,

You are welcome.
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Re: Converting Crystal to Stimulsoft

Post by dwabare92 »

Lech, this is the error I am getting. "There is no matching overloaded method for 'AddMonths(String)'"
Any ideas?

Currently writing in CSharp
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Converting Crystal to Stimulsoft

Post by Lech Kulikowski »

Hello,

Try to use
OrderDet.User_Date1.AddMonths((int)Estim.User_Text2)

Thank you.
dwabare92
Posts: 10
Joined: Thu Oct 06, 2022 8:25 pm

Re: Converting Crystal to Stimulsoft

Post by dwabare92 »

Lech, made some progress with this:

{ (DateDiff(Today, PLMain.Relation.User_Date1.AddMonths((int)PLDet.Relation2.User_Text2)).Days )} / {(DateDiff(PLMain.Relation.User_Date1, PLMain.Relation.User_Date1.AddMonths((int)PLDet.Relation2.User_Text2)).Days * 100).ToString() }

If I make them into 1 formula (below) it gives me the error "There is no matching overloaded method for 'op_Div(Int32,String)'

{ (DateDiff(Today, PLMain.Relation.User_Date1.AddMonths((int)PLDet.Relation2.User_Text2)).Days ) / (DateDiff(PLMain.Relation.User_Date1, PLMain.Relation.User_Date1.AddMonths((int)PLDet.Relation2.User_Text2)).Days * 100).ToString() }

PLMain.Relation.User_Date1 = 10/2/2022
PLDet.Relation2.User_Text2 = 5

If it makes it simpler...the ultimate goal is to figure out (the number of days elapsed since User_Date 1) / ((The total number of days between User_Date1 and User_Text 2) *100)
In this case it would be 8 / 150
Post Reply