Writing Function in Stimulsoft

Stimulsoft Reports.NET discussion
Post Reply
xeyyam
Posts: 22
Joined: Wed Jul 06, 2011 1:34 am
Location: Az

Writing Function in Stimulsoft

Post by xeyyam »

Hi.

I have reports in Crystal Reports and now i want to create this report in Stimulsoft . I wrote many formulas in Crystal Report , but now i dont know how write this formulas in Stimulsoft . Please help me .
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Writing Function in Stimulsoft

Post by HighAley »

Hello.
xeyyam wrote:Hi.

I have reports in Crystal Reports and now i want to create this report in Stimulsoft . I wrote many formulas in Crystal Report , but now i dont know how write this formulas in Stimulsoft . Please help me .
We have import of reports from Crystal Report. But unfortunately it can't convert complicated formulas because Crystal uses a completely different format of expression. We don't have plans to develop this feature, because it requires very hard developments.

If you have any exact problems in converting formulas to Stimulsoft Reports we'll be glad to help you.

Thank you.
xeyyam
Posts: 22
Joined: Wed Jul 06, 2011 1:34 am
Location: Az

Writing Function in Stimulsoft

Post by xeyyam »

I want to know how can i write my own functions in Stimulsoft . For example i have variable and this variable depend on some compilicated function , So can can write this function and make my variable depen on this function ?
xeyyam
Posts: 22
Joined: Wed Jul 06, 2011 1:34 am
Location: Az

Writing Function in Stimulsoft

Post by xeyyam »

HighAley wrote:Hello.
xeyyam wrote:Hi.

I have reports in Crystal Reports and now i want to create this report in Stimulsoft . I wrote many formulas in Crystal Report , but now i dont know how write this formulas in Stimulsoft . Please help me .
We have import of reports from Crystal Report. But unfortunately it can't convert complicated formulas because Crystal uses a completely different format of expression. We don't have plans to develop this feature, потому что it requires very hard developments.

If you have any exact problems in converting formulas to Stimulsoft Reports we'll be glad to help you.

Thank you.
My variable depends on such furmula :

shared stringVar array holidays := Split({GET_TABELNW_REPORT.HOLIDAY}, ",");
shared numberVar size := ubound(Split({GET_TABELNW_REPORT.HOLIDAY}, ","));
local numberVar i;
local stringVar result := 'false';
for i := 1 To size Do
(
if 1 = toNumber(holidays) then
result := 'true';
);
if not IsNull({GET_TABEL_REPORTNEW.END_DATE}) then
if Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)<{GET_TABEL_REPORTNEW.BEGIN_DATE} then
''
else
if Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) <= {GET_TABEL_REPORTNEW.END_DATE} then

if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] and result = 'true' then
'B'
else if (not IsNull({GET_TABEL_REPORTNEW.MEZUNIYYET})) and (not IsNull({GET_TABEL_REPORTNEW.MEZUNIYYET_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.MEZUNIYYET_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.MEZUNIYYET_BEG_DAY} to {GET_TABEL_REPORTNEW.MEZUNIYYET_END_DAY})) then
'M'
else
if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] then
'i'
else if result = 'true' then
'B'
else if (not IsNull({GET_TABEL_REPORTNEW.DIFF_XESTELIK}))and (not IsNull({GET_TABEL_REPORTNEW.XESTELIK_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.XESTELIK_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.XESTELIK_BEG_DAY} to {GET_TABEL_REPORTNEW.XESTELIK_END_DAY})) then
'X'

else if (not IsNull({GET_TABEL_REPORTNEW.ODENISSIZ_MEZUNIYYET})) and (not IsNull({GET_TABEL_REPORTNEW.ODENISSIZ_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.ODENISSIZ_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.ODENISSIZ_BEG_DAY} to {GET_TABEL_REPORTNEW.ODENISSIZ_END_DAY})) then
'ÖM'
else if (not IsNull({GET_TABEL_REPORTNEW.SOSIAL_MEZUNIYYET})) and (not IsNull({GET_TABEL_REPORTNEW.SOSIAL_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.SOSIAL_END_DAY})) and ( Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.SOSIAL_BEG_DAY} to {GET_TABEL_REPORTNEW.SOSIAL_END_DAY})) then
'SM'
else if (not IsNull({GET_TABEL_REPORTNEW.TEHSIL_MEZUNIYYET})) and (not IsNull({GET_TABEL_REPORTNEW.TEHSIL_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.TEHSIL_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.TEHSIL_BEG_DAY} to {GET_TABEL_REPORTNEW.TEHSIL_END_DAY})) then
'TM'
else if (not IsNull({GET_TABEL_REPORTNEW.NAMELUM_MEZUNIYYET})) and (not IsNull({GET_TABEL_REPORTNEW.NAMELUM_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.NAMELUM_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.NAMELUM_BEG_DAY} to {GET_TABEL_REPORTNEW.NAMELUM_END_DAY})) then
'NM'
else if (not IsNull({GET_TABEL_REPORTNEW.ANALIQ_MEZUNIYYETI})) and (not IsNull({GET_TABEL_REPORTNEW.ANALIQ_M_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.ANALIQ_M_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.ANALIQ_M_BEG_DAY} to {GET_TABEL_REPORTNEW.ANALIQ_M_END_DAY})) then
'AM'
else if (not IsNull({GET_TABEL_REPORTNEW.IS_BURAXMAQ})) and (not IsNull({GET_TABEL_REPORTNEW.IS_BURAXMAQ_BEG_DAY}) and (not IsNull({GET_TABEL_REPORTNEW.IS_BURAXMAQ_END_DAY})) and (Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1) in {GET_TABEL_REPORTNEW.IS_BURAXMAQ_BEG_DAY} to {GET_TABEL_REPORTNEW.IS_BURAXMAQ_END_DAY})) then
'İB'
else if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] and
result = 'true' then
'B'

else if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] then
'i'
else if result = 'true' then
'B'
else if {@f2}='B' then
ToText(({GET_TABEL_REPORTNEW.OFFICE_HOURS}-1),0)
else
ToText({GET_TABEL_REPORTNEW.OFFICE_HOURS},0)
else
if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] then
'i'
else
' '
else
if DayOfWeek(Date({GET_TABEL_REPORTNEW.B2},{GET_TABEL_REPORTNEW.B1},1)) in [7,1] then
'i'
else
' '

HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Writing Function in Stimulsoft

Post by HighAley »

Hello.

You can write your function on the Code tab in the begin of report, for example:

Code: Select all

Namespace Reports
    
    Public Class Report
		Inherits Stimulsoft.Report.StiReport
		
		
		Public Function GetDateString(ByVal dateToConvert As DateTime) As String
			'
			'Place your code here
			'
			Return "new date string"
		End Function
		
		
        Public Sub New()
            MyBase.New
            Me.InitializeComponent
            .....
and then use this function in expressions, for example:

DateTimeStandard: {DateTime.Now}
DateTimeModified: {GetDateString(DateTime.Now)}

Thank you.
xeyyam
Posts: 22
Joined: Wed Jul 06, 2011 1:34 am
Location: Az

Writing Function in Stimulsoft

Post by xeyyam »

Thank you a lot.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Writing Function in Stimulsoft

Post by Andrew »

As always we are glad to help you.

Thank you.
Post Reply