Page 1 of 2
Converting Crystal to Stimulsoft
Posted: Thu Oct 06, 2022 8:36 pm
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 ""
Re: Converting Crystal to Stimulsoft
Posted: Sat Oct 08, 2022 7:14 pm
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.
Re: Converting Crystal to Stimulsoft
Posted: Sat Oct 08, 2022 8:57 pm
by dwabare92
Lech, this works great! Thank you so much!
Re: Converting Crystal to Stimulsoft
Posted: Sat Oct 08, 2022 9:07 pm
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))
Re: Converting Crystal to Stimulsoft
Posted: Sun Oct 09, 2022 8:48 am
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.
Re: Converting Crystal to Stimulsoft
Posted: Sun Oct 09, 2022 3:57 pm
by dwabare92
I will give it a shot. Thank you
Re: Converting Crystal to Stimulsoft
Posted: Sun Oct 09, 2022 8:09 pm
by Lech Kulikowski
Hello,
You are welcome.
Re: Converting Crystal to Stimulsoft
Posted: Mon Oct 10, 2022 11:44 am
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
Re: Converting Crystal to Stimulsoft
Posted: Mon Oct 10, 2022 1:36 pm
by Lech Kulikowski
Hello,
Try to use
OrderDet.User_Date1.AddMonths((int)Estim.User_Text2)
Thank you.
Re: Converting Crystal to Stimulsoft
Posted: Mon Oct 10, 2022 2:51 pm
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