Vous êtes sur la page 1sur 43

List of Expressions in the Existing System

1) Abs(Integer arg1):Unsigned Integer Gives the unsigned integer value of the arg1. Example: Abs(-10) = 10. 2) AddToMonth(Date arg1, int agr2):Date Gives the Date after adding the numeric to the month field in the Date Example: AddToMonth(28/04/2010,4) gives 28/08/2010 3) AddToDate(Date arg1, int arg2):Date Gives the Date after adding the integer to the Day of the month in the Date Example: AddToDate(12/05/2008,7) gives 19/05/2008 4) AddToTime(Time arg1, Time arg2):Time (This is no longer in use) Gives the Time after adding the Time(arg2) to the Time (agr1) Example: AddToTime(11:20:32,1:20) gives 12:40:32 5) Amtword(int arg):String Gives words of the numeric Example: Amtword(400):Rupees Four Hundred

6) ChildOf(Tablename arg1,FieldName arg2,FieldLevel

agr3,FieldValue):Boolean
Returns True if the fieldname is present as child of any group. Example: ChildOf(Master,MID,1~2~3~2,1~2~234~75658) Set of values separated by Tild Returns True if MID is present as child in any given group

7) CmonthYear(Date arg):String
Gives the month name with year from the Date argument. Example: CmonthYear(01/05/2010) returns May 2001 8) Convert():(Doubt) 9) CTOD(arg1):Date (Doubt) Gives the formatted characters into Date type Example: CTOD('01/05/2011') gives 01/05/2011 10) DayOfDate(Date arg ):int Returns the day in the Date. Example: DayOfDate({09/06/2010}) returns 09 11) Date():Date Gives the System Date

12) DTOC(Date arg):String(Doubt)

Converts the Date to Characters Example: DTOC(Date arg) gives 01/05/2010(in characters) 13) DaysElapsed(Date arg1,Date arg2):int Returns the difference between the dates arg1 & arg2 Example: DaysElapsed(10/04/2010,14/04/2010) gives 4 14) Decode(strCode:String,Code:String)(No longer in use) 15) Excludes(FieldName arg1, Set of Field values)(doubt) 16) Eval(Expression arg):String Evaluates the Expression and gives the value Example: Eval(5*2) gives 10 17)Encode():(Doubt) 18) FindAndReplace(String arg1,String arg2,String arg3):String Returns the String by replacing the arg3 for arg2 in arg1 String Example: FindAndReplace(String {ssssfffjjj},String {ssss},String {nn} ) gives nnfffjjj 19) FormatSQLResult(Function SQLName,FormatString:String) Returns the Formatted SQL result Example: FormatSQLResult({FunctionQuery},{AccountName:%|l50|mname%,Amount%| r15|amount%})

mname carries 50 char length which is left aligned. amount carries 15 char length which is right aligned.

20)FormatDateTime(FormatString, DateTime)
Formats the given date & time using the format string. The FormatString could be as given below.c Displays the date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the date-time value indicates midnight precisely.d Displays the day as a number without a leading zero (1-31). dd Displays the day as a number with a leading zero (01-31). ddd Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable. dddd Displays the day as a full name (Sunday-Saturday) using the strings given by theLongDayNames global variable. ddddd Displays the date using the format given by the ShortDateFormat global variable. dddddd Displays the date using the format given by the LongDateFormat global variable. e Displays the year in the current period/era as a number without a leading zero (Japanese,Korean and Taiwanese locales only). ee Displays the year in the current period/era as a number with a leading zero (Japanese,Korean and Taiwanese locales only). g Displays the period/era as an abbreviation (Japanese and Taiwanese locales only). gg Displays the period/era as a full name. (Japanese and Taiwanese locales only). m Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier,the minute rather than the month is displayed. mm Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier,the minute rather than the month is displayed. mmm Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.

mmmm Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.yy Displays the year as a two-digit number (00-99) yyyy Displays the year as a four-digit number (0000-9999). h Displays the hour without a leading zero (0-23) hh Displays the hour with a leading zero (00-23). n Displays the minute without a leading zero (0-59). nn Displays the minute with a leading zero (00-59) s Displays the second without a leading zero (0-59). ss Displays the second with a leading zero (00-59) z Displays the millisecond without a leading zero(0-999). zzz Displays the millisecond with a leading zero (000-999).t Displays the time using the format given by theShortTimeFormat global variable. tt Displays the time using the format given by the LongTimeFormat global variable.am/pm Uses the 12-hour clock for the preceding hor hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower,upper, or mixed case, and the result is displayed accordingly.a/p Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly. am\pm Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the TimePMString global variable for any hour after noon. / Displays the date separator character given by the DateSeparator global variable.: Displays the time separator character given by the TimeSeparator global variable.'xx'/"xx" Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting. 21) FieldChanged(FieldName,RowId):Boolean Returns the boolean value depending upon the fieldvalue is changed or not. Example: FieldChanged('Customer Name',2) returns T if fieldvalue is changed. 22) GetInteger(double arg1):int

Returns the integer part in the decimal number Example: GetInteger(12.45) returns 12 23) GetCell(FieldName arg1,FieldName arg2,FieldValue arg3) Returns the value of arg1(col name) from the row in which the agr2 has arg3. Example: GetCell(col1,col2,23) returns 56 Col 1 45 56 Col 2 34 23 Col3 65 76

24) GetAdjustedAmount():int(doubt) Gets the adjusted Amount in a particular adjustment 25) GetCostRate(int ItemId,Date DocDate,qty,valMthd): Gives the CostRate for the given parameters. 26) GetRCell(String colname, int rowno) Returns the value of the cell identified by ColName and rowno Example GetRCell({Col3},1) returns 15 Col1 12 171 col2 14 134 col3 15 34

27) GetRowCount(String FieldName):int

Returns the total number of rows in the grid for the given field Example: GetRowCount(col3) returns 6 Col1 1 3 7 67 45 34 Col2 2 4 8 76 43 34 Col3 3 5 6 54 34 56

28) GetRow(String Fieldname,value FieldValue):int Returns the row for the given fieldvalue in the given Fielname column Example: GetRow({Team},{A}) returns 1 RowidTeam 1 2 3 4 A A B C Score 12 14 13 16

29) GetId(String FieldName,int Rowno) Returns the Id of the given Field which is identified by its Fieldname and rownumber Example: GetId({Team},2) returns the Id value of B Sno 1 2 3 4 Team A B C D Score 23 24 34 15

30) GetMax(String FieldName):int Returns the Maximum value of the given field in the grid Example: GetMax(Score) returns 95 Sno 1 2 3 4 Team A B C D Score 43 54 84 95

31)Gen_id(S,N) Returns a Globally unique number . If N=0 then the number will always be unique else its unique for that session only. 32) HashChar(String arg) Returns the sum of byte values in the String. 33) IIF(Expression ,{T},{F}) Evaluates the expression,If the expression returns true, trueresult is evaluated else falseresult is evaluated. Example: IIF(5>6,Success,Failure) returns Success IIF(7>6,Success,Failure) returns Failure 34) Includes(doubt) 35) IsEmptyValue(Value,Datatype:String):Boolean Returns True if the given value is empty otherwise returns false . Even numeric 0 is not considered as an empty. Only '' or NULL is considered empty. Example: IsEmptyValue():Boolean

36) IsEmpty(String value):Boolean Returns True if the value returns Empty. Example: IsEmpty():Boolean 37) Lower(String arg):String Converts the given String to Lower case String. Example: Lower('ABCdef') gives abcdef 38) LastDayOfMonth(Date arg):Date Returns the last day for the month identified in the date parameter Example: LastDayOfMonth(10/02/2010) gives 28/02/2010 LastDayOfMonth(10/02/2012) gives 29/02/2012 39) MandY(Date arg): Returns the year and month of the given date argument. Example: MandY(12/05/2007) gives 2007 12 40) MakeDate(int arg1,int arg2,int arg3):Date Returns the Date from the given inputs arg1(day),arg2(month),arg3(year) . Example: MakeDate(02,04,2010) gives 02/04/2010 41) MonthOfDate(Date arg):int

Returns the integer value of the month given in the Date argument Example: MonthOfDate(12/04/2012) gives 04 42) Power(long arg1,long arg2):long Returns the long value from the calculated inputs. Example: Power(2,3) gives 8 Power(4,2) gives 16 43) RevConvert():(Doubt) 44) RND(float arg1,int arg2):float Rounds off the given arg1(amount) nearest to the arg2(RoundTo) figure. The RoundTo could be 100 which rounds the amount to the nearest 100. If RoundTo is 50 the amount will be rounded to the nearest 50. Example: RND(50.45,100) gives 50 RND(50.65,100) gives 51 RND(50.45,50) gives 50.50 RND(50.20,100) gives 50 RND(50.65,50) gives 50.50 45) ROUND(float arg1,int arg2):float Rounds the given number to given decimals Example: ROUND(20.652,0) gives 21 ROUND(20.652,1) gives 20.7

ROUND(20.652,2) gives 20.65 46) STR(int arg):String Converts the given number to String. Example: STR(123) gives 123 47) STUFF(String arg1,String arg2,int arg3):String inserts the arg2 to arg1 at position given by arg3 Example: STUFF({wxyz},{a},3) gives wxayz STUFF({wxyz},{},3) gives wxz STUFF({wxyz},{abcd},3) gives wxabcdyz 48) SUBSTR(String arg1, int arg2, int arg3):String Returns the number of characters from Position(arg2) to numeric mentioned in numeric(arg3) Example: SUBSTR({1234ABC},5,3) gives ABC 49) Sum(Fieldname arg1,Fieldvalue arg2,String arg3) Cumulates the value in Cumulatefield(arg3). Consider only rows where the value in Fieldname is equal to Fieldvalue Example: Sum({Team},{A},{Score}) gives 40 Sno 1 2 3 4 5 6 Team A A B C D A Score 14 15 17 18 16 11

50) SumTill(FieldName arg1,FieldValue arg2,String arg3,int arg4) Do the conditional cumulation till the given rowno.Cumulates the value in Cumulatefield(arg3). Consider only rows where the value in Fieldname is equal to Fieldvalue and rowno(arg4) is less than or equal to the given rowno(arg4) Example: SumTill({Team},{A},{Score},4) gives 59 Sno 1 2 3 4 5 6 Team A A B C D E Score 25 34 32 45 56 67

51) Time() Gives the current time of the localMachine 52) Total(String arg) Gives the cumulated value for the given fieldname(arg) . Example: Total(score) gives 70 Sno 1 2 3 4 5 Team A B C D E Score 12 13 14 15 16

53) TimeElapsed(Date arg1,Date arg2):Double Gives the difference between the arg1(time) and arg2 (time) in number of hours. Example: TimeElapsed(11:30:20,12:40:20) gives 1:10

54) Upper(String arg) Returns the String in Upper Case. Example: Upper('abcdef') gives ABCDEF 55) Val(String arg) Returns the given characters into its numeric equivalent. Example: Val({123}) gives 123 56) ValidEncodeDate(int arg1, int arg2, int arg3):Date Converts the given arguments Year(arg1), Month(arg2), Day(arg3) into Date. After converting it to the Date it validates and adjusts to the last date of the month. Example: ValidEncodeDate(2010,02,04) gives 04/02/2010 ValidEncodeDate(2010,02,30) gives 28/02/2010 ValidEncodeDate(2012,02,30) gives 29/02/2010 57) YearOfDate(Date arg) Returns the year in the Date. Example: YearOfDate(01/05/2010) gives 2010 Functions whose behaviour is not known or no longer in use: 58)GetValue(FieldName arg1,RowNo arg2):String Returns the value of the field at the given row. Example: GetValue({Team},3) gives C

Sno 1 2 3 4 5

Team A B C D E

Score 12 13 14 15 16

59)GetOld(FieldName arg1,Rowno arg2) Returns the old value in a field at the given row. Example: GetOld(category,1) returns A Sno 1 2 3 4 5 Team AB B C D E Score 12 13 14 15 16

60)Cell(int arg1,int arg2) Returns the value of the cell identified by the arg1(col.index) and arg2(rowindex). Example: Cell(2,3) gives C Sno 1 2 3 4 5 Team A B C D E Score 12 13 14 15 16

61)GetMin(FieldName) Returns the minimum value in the column identified by the fieldname. Example: GetMin(Score) returns 12 Sno Team Score

1 2 3 4 5

A B C D E

12 13 14 15 16

TSTRUCT FUNCTIONS:
62)HideFrame(FrameNo int, Boolean) HideFrame(FrameNo , {T}) hides the frame HideFrame(FrameNo , {f}) will not hide the frame 63)MakeTreeId:(not in use) 64)setValue(String FieldName,int rowno, String value) Set the value for the given field at the given row to the given value. Example: setValue({item},2,a1) sets the value to a1. 65)GetSqlValue(Sqltext,String Colname) Same as FireSql. 66)SetProperty(String fname, Propertyname, String value) Sets the property with the given value for the field given by fname. PropertyName could be any of the following Readonly visible ModeOfEntry SQL Caption Suggestive Expression ValidateExpression FontName FontSize FontColor

- FontStyle - Color - Decimals Example: {OnFormLoad} flag := iif(Authorised={Yes}, {F}, {T}) SetProperty({DocNo}, {ReadOnly}, flag) 67)SetSequence(FieldName, Prefix:String) Sets the sequence from the next number should be generated for an autogenerated field. Note : The functions related to numbering sequence viz SetSequence & SetExtSequence cannot be used in OnFormLoad. Moreover, the case of the parameters should exactly match the ones defined in the tables. That is, if the field name is defined in lowercase, the field name should be in lower case in these functions also. Example : Consider a TStruct that has a field name Type. This can have values A or B. If it is A, then the DocNo field following this field should have the 'AAA-' sequence selected. If type is not A, then the sequence for DocNo should be 'BBB-'. {OnExit Type} seq := iif(Type = {A}, {AAA-}, {BBB-}) SetSequence({DocNo}, Seq) 68)ResetActivecomp() Use this function if some of the components are hidden using the SetProperty function in an expression set. This will focus on the next visible component. 69)LoadTempFile(FileName) Loads the data the given filename into the transaction form. This data should have been stored by the "Save To File" option in the transaction form. 70)DeleteTempFile(FileName) Deletes the temporary file in which a transaction data has been stored. The temporary file should have been created by the "Save to file" option.

71)ActivateField(Fieldname, RowNo) This function will set the focus on the given field and rowno. This function can be used in an expression set to set focus conditionally on a field. Example {onexit docid} ActivateField({CustCode}, 1) The above expression set will set focus to the customer name field when exit from the Docid field. 72)AllowFrameChange(FrameNo, Allow) This function will disallow changes to any field in the given frameno if Allow is f. It allows changes if allow is t. This can be used in an expression set to set a frame readonly. Example To disallow modification of fields in first frame in modification mode set the expression set as follows : {AfterLoadData} AllowFrameChange(1, {f}) 73)AllowFieldChange(FieldName, Allow) Changes to a given field will be disallowed if Allow is f & vice versa if allow is t. This can be used in an expression set to set a field readonly. Example To disallow modification of the rate field data entry operators, use the following expression set. {OnFormLoad} c := iif(usercategory = {data entry}, {f}, {t}) AllowFieldChange({Rate}, c) FieldName could be 'FrameNo='. In this case all the fields in the frame will be set to readonly if flag is false. This will work like AllowFrameChange. However, this will allow deletion of rows. The advantage of using this is that all the fields in a frame can be set to read only and with another call to AllowFieldChange, specific fields could be made editable. Example : Consider a grid frame with 20 columns. If user A logs in only 2 columns name Qty & Rate should be editable in modification mode. This can be achieved by giving an expression set as

follows : {OnFormLoad} flag := iif(username = {a} & recordid > 0, {F}, {T}) AllowFieldChange({FrameNo=2}, {flag}) AllowFieldChange({Qty}, {T}) AllowFieldChange({Rate}, {T})

74)PrintDocNames
This is a variable which can be set in an expression set. The document names that need to be printed can be set in this variable. If there are more than one document, it can be given as a comma seperated string. If this variable is set, the print format selection window will not pop up. Example : 1.. PrintDocNames := {printform1, printform2} 2.. PrintDocNames := iif(usercategory = {data entry}, { printform1}, {printform1, printform2}) 75)ExecuteOption(Caption) This function can be used in an expression set to execute any functionality associated with any button in the Transaction form. The button caption is sent as a parameter to that function. Example : {OnDCEnter Grid Frame} ExecuteOption({FillGrid}) FillGrid is the caption of a button in the Tstruct. 76)RefreshFrame(FrameNo) This function will refresh all the fields in a frame. In case of a grid frame all the rows will be refreshed. 77)InitGrid(FrameNo) Delete all rows from a grid frame given by frameno. 78)GetOld(FieldName, RowNo)

This function will return the old value of the given field & row. This is valid only when a transaction is modified. The old value is the value that was stored in the database before the transaction was loaded for modification. 79)GetOldId(FieldName, Rowno) This function will return the old id value of the given field & row. 80)SQLRegVar(SQLText) This function will register the result of the SQL for using them in expressions. The SQL result should have the following columns :VarName VarType VarValue The function will register the given varname with the varvalue. For example if the SQL result is as follows VarName a1 a2 a3 VarType n c d VarValue 100.00 abc 01/04/2004

Three variables will be registered as follows : a1 = 100.00 a2 = abc a3 = 01/04/2004 Now these, vars could be used in expressions. 82)CheckStock(ItemId, OldItemId, DocDate, ldDocDate,PlusOrMinus,

Qty,OldQty)
This function will check if enough stock is available to carry out the transaction for the given ItemId as on given DocDate for the Qty. In case of modification mode, the old values will be used if the modification can be allowed. The function will return T if the transaction can be allowed or else a message will be returned. 83)AllowedUserNames This is a system variable. The sequence window allows users to both select & edit the sequences. In case there is a need to allow only certain users/user categories to modify or add to sequence list,it can be achieved as follows {OnFormLoad} AllowedUserNames := {user1,user2} In case the control has be set on user categories then {OnFormLoad} AllowedUserCategories := {usercategory1, usercategory2}

84)EnableButton(caption, flag) Any button in a TStruct can be conditionally enabled/disabled. For example to disable the save button if user1 has logged in and enable it other wise, define an expression set as follows {onformload} f := iif(username = {user1}, {F}, {T}) enablebutton({save}, f) 85)GetSubTotal(FieldName, ParentRow) This function can be used in TStructs to get the total of any field from a sub form into a field in parent grid. The field given by fieldname (which is to be in the sub form) is summed and returned. Only rows related to the given parentrow will be summed. Example : In accounts voucher, to get the sum of costamount and store in another column in the accounts grid set the expression as follows : GetSubTotal({CostAmount}, ActiveRow) 86)RoudedDiff(FieldName, RowNo, RoundTo) This function will round off the value in fieldname to the nearest whole number based on the value given in RoundTo. The difference between the rounded value and the actual value will be returned by this function. If rowno is greater than zero then all the values in the column till Rowno will be cumulated and then rounded. Example : Consider the amount column in a grid in a TStruct. This needs to be cumulated and rounded of to the nearest rupee. The difference has be got into the roundoff field. To do this an expression as below can be defined for the roundoff field RoundedDiff({Amount}, -1, 100) If the cumulation has to be done till acitverow then the expression would be RoundedDiff({Amount}, ActiveRow-1, 100) 87)SetSystemVar(Varname, Value)

Any of the system vars can be changed from a TStruct. This can be done by using the SetSystemVar function. 88)ExternalSave(MapName) This function will save data in another TStruct. The Mapname is the name of a ESMap.

89)TrimVal(Value: string)
Returns a trimmed value of the given string. Example : TrimVal({ abc }) returns abc. 90)GetLength(value : string) Returns the length of the string. Example : GetLength({xyz}) returns 3. 91)FormatAmount(Value,DecLen:numeric,withComma,MillionRep,Neg

ativeRep,PositiveRep : String)
This will format the number given in Value parameter. DecLen is number of decimals. WithComma - if {T} will insert commas. MillionRep - if {T} will insert commas as it is in a millions system. NegativeRep - if {br} then shows negative amounts within parenthesis else appends the given string to the negative number. PositiveRep - if {br} then shows negative amounts within parenthesis else appends the given string to the positive number. Example : FormatAmount(100000, 2, {F},{F}, {br}, {}) -> 100000.00 FormatAmount(-100000, 2, {F},{F}, {br}, {}) -> (1,00,000.00) FormatAmount(100000, 2, {F},{F}, {Cr}, {}) -> 1,00,000.00 Cr

FormatAmount(100000, 2, {T}, {T},{}, {Db}) -> 100,000.00 Db 92)FormatAccAmount(Value,DecLen:numeric, withComma,

MillionRep, ALIE, Rep :String)


Converts the given numeric value into a formatted string. DecLen is number of decimals. WithComma - if {T} will insert commas. MillionRep - if {T} will insert commas as it is in a millions system. ALIE - could have a value a,l,i or e. A stands for Assets, l for Liability, i for income & e for Expense. For Assets & Expenses value greater than zero is considered as positive & less than zero is considered as negative. For Liabilities & Income, value < 0 is considered as positive & > 0 is considered as negative. Rep - if {br}, negative amounts will be enclosed in parenthesis else the string will be appended to the negative amount. For Example: FormatAccAmount(100000,2,{f},{T},{A},{br}) gives 100000.00 FormatAccAmount(100000,2,{f},{T},{L},{br}) gives (100000.00) FormatAccAmount(-100000,2,{f},{T},{A},{br}) gives (100000.00) FormatAccAmount(100000,2,{f},{T},{L},{br}) gives 100000.00 93)FormatValue(value, DecLen numeric, ApplyCommas,MillionRep

String)
Format the given numeric value & returns a formatted string. DecLen - specifies the number digits after decimal in the result. WithComma - if {T} will insert commas. MillionRep - if {T} will insert commas as it is in a millions system. Example : FormatValue(100000, 2, {F}, {F}) -> 100000.00 FormatValue(100000, 2, {T}, {F}) -> 1,00,000.00

FormatValue(100000, 2, {T}, {T}) -> 100,000.00

94)LeftPad(S: String; MaxLength: integer; c: Char) Pads the given string S to the left to make the length of the string equal to MaxLength. The character that is padded is given in c. Example : LeftPad('abc', 5, 'x') -> 'xxabc' 95)Pad(S: String; MaxLength: integer; c: Char) Pads the string S to the right with the character given in C. Example : LeftPad('abc', 5, 'x') -> 'abcxx' 96)CurrAmtWord(Amount : Numeric, Currency, SubCurrency,

InMillions: string, Decimals :integer)


Converts the given amount to words as per the specification. Currency - Name of the currency to convert to. SubCurrency - Name of the sub currency InMillions - {T} if amount should be in millions. Decimals - number of decimal digits in the amount. Example : CurrAmtword(1200000, {Dollars}, {Cents}, {T}, 2) -> One million two hundred thousand only. CurrAmtword(1200000, {Rupees}, {Paise}, {T}, 2) ->Twelve lacs only. 97)Lpad(S: String;Width: integer;padChar: Char) Same as LeftPad.

98)Rpad(S: String;Width: integer;padChar: Char)


Same as Pad.

99)GetMod(Num, Divisor : Numeric) Returns the reminder after dividing num by divisor. Example : GetMod(10/3) -> 1

100)Trim(S:String) Removes the leading & trailing spaces & special characters from S. 101)Firesql(SqlName, SQLText) Fires the sql given in SQLText. The SQL result can be accessed in FindRecord & SQLGet functions using the SQLName. Example : FireSQL({SQL1},{Select name, basic from Employees}) - Fires SQL & stores result in SQL1. FindRecord({SQL1}, {name}, {Emp-1}) - Finds the record that has name = Emp-1 in SQL1. B := SQLGet({SQL1}, {basic}) - Returns the value in the basic column in SQL1 from the current record. So the above 3 statements will get all employee details, finds the record with name = emp1 & returns Emp-1's basic salary. 102)FindRecord(SQLName, SearchColumn, SearchValue) Finds the row in the SQL result identified by SQLName that has the SearchValue in the SearchColumn. Example : FireSQL({SQL1},{Select name, basic from Employees})- Fires SQL & stores result in SQL1. FindRecord({SQL1}, {name}, {Emp-1}) - Finds the record that has name =Emp-1 in SQL1. B := SQLGet({SQL1}, {basic}) - Returns the value in the basic column in SQL1

from the current record. So the above 3 statements will get all employee details, finds the record with name = emp1 & returns Emp-1's basic salary. 103)SQLGet(SQLName, ColumnName) Returns the value of the given ColumnName in the current row in the SQL result identified by SQLName Example : FireSQL({SQL1},{Select name, basic from Employees})- Fires SQL & stores result in SQL1. FindRecord({SQL1}, {name}, {Emp-1}) - Finds the record that has name = Emp-1 in SQL1. B := SQLGet({SQL1}, {basic}) - Returns the value in the basic column in SQL1 from the current record. So the above 3 statements will get all employee details, finds the record with name = emp1 & returns Emp-1's basic salary. 104)DPImport(FileName) This function will import data from a data packet that is stored in a file given by the Filename parameter. This will work just as the import program works. 105)DPExport(DefName, FileName, ExpType, SiteNo) This function will export the data into an ASCII file. DefName - Name of the export definition. FileName - Name of the ASCII file into which the data should be exported into. The format of the export file cannot be changed. ExpType :Set ExpType to 'exportall' to export all the data from the transactions defined in the database. Set this to 'export' to export only the latest data that has been entered or modified after the lastexport. To export data that has been entered/modified after a given date & time, set the date & time to the exptype parameter. 106)FixTree(TransId) This function will run the fix tree utility that was introduced in 493. Refer to the 493 release document for info on fix tree utility. 107)PostMDMap(Transid)

This function will run the Re-Update MD Map utility that was introduced in 493. Refer to the 493 release document for info on this utility. 108)Repost(Transid, Condstr) This function will run the re-save transaction utility that was introduced in 493. Refer to the 493release document for info on the utility. 109)Regenerate(Transid) This function will run the regenerate transaction utility that was introduced in 493. Refer to the 493 release document for info on the utility. 110)PostGenMap(Transid, GenMaps, ConditionString) This function will run the Post Gen Map utility that was introduced in 493. Refer to the 493 releasedocument for info on the utility.GenMaps is a comman delimited string of LinkEntryDocId that need to be posted. 111)Gettransid(TransDesc) Returns the transid of the transaction. Transdesc is the caption for the transaction. 112)GetDelimitedStr(SQLResult, FieldName, Delimiter) This function creates a string from the SQL Result. The values in the given fieldname will be made into one string with delimited with the given Delimiter. Example : If an SQL result is as follows : Col1 Col2 A 10 B 20 C 30 GetDelimitedStr({SQLResult1}, {Col2} ,{,}) -> 10,20,30 113)CSVImport(DefinitionName) The definition name is the name of the definition that is made in the ImpExp table. This function will import from a CSV file into a Transaction structure. Refer to the topic on ToolKit - Import/Export. 114)OpenDialog()

Use this function in expression sets to display a open dialog window to do selection of files. The selected file is returned. 115)SaveDialog() Use this function in expression sets to display a save dialog window to do selection of files. The selected file is returned. 116)XRun(Name) Name is the name of an application or a document. If name is a MS Word document then document will be opened with MS Word. If name is a pdf file then the file will be opened using a Adobe reader etc. If the name is an application then the application will be executed. Parameters to the application can be passed by suffixing the application name with % symbol followed by the parameters. For example to open a file named abc.txt throught wordpad use XRun({WordPad % abc.txt})

117)PlaceForm(FormName, FormPrms) The window cordinates for search windows, fillgridforms & dataseek forms can be set using this function. FormPrms is a string that consists of comma seperated name value pairs. Example: To set the window coordinates of fillgrid form named 'Fill One'PlaceForm({Fill One}, {top=10,left=100,height=300,width=300}) 118)ReverseString(s:String):String This function will reverse the given string & return. 119)Instr(S, C, FromPos) : int Searches for c in s from FromPos. Eg. Instr({abcdcde},{c},1) returns 3 Instr({abcdcde},{c},4) returns 5 Instr({acbcdcde},{c},-4) returns 3

120)GetStockValue(ItemId:numeric, DocDate : Date, IssueQty:

numeric, VMethod:Char)
All stock related transactions are stored in the StockValue TStruct. This function will return the value of the quantity issued. It will apply the valuation method given by VMethod. Valuation methods could be FIFO or Weighted Average. 121)GetClosingStock(ItemId: numeric; DocDate: Date; VMethod:

string):
This function returns the closing stock of the given item on the given DocDate using the valuation method given by VMethod. The closing stock will be registerd in the following variables - Op_StockQty - Op_StockValue - Rec_StockQty - Rec_StockValue - Iss_StockQty Iss_StockValue These variables can be used in expressions. These will have the appropriate values after the function is called.

IVIEW FUNCTIONS
122)GetCell(ColName, RColName, Rvalue: string) Returns the Value in ColName from the row in which RColName has Rvalue. Example : Consider an IView result as follows Col1 A B Col2 10 30 Col3 20 40

GetCell({Col2}, {Col1}, {A}) -> 10 123)GetRCell(ColName: string; RowNo: integer)

Returns the value from the cell identified by ColName & RowNo. Example : Consider an IView result as follows Col1 A B Col2 10 30 Col3 20 40

GetRCell({Col1}, 2) -> B 124)GetColNo(Colname: string) Returns the column number of the given column. 125)GetRowno(colno: integer; Rvalue: string) Returns the Rowno in which the value in the column identified by colno that matches Rvalue. Example : Consider an IView result as follows Col1 A B Col2 10 30 Col3 20 40

GetRowNo(1, {B}) -> 2 126)ComputePost(ColName: String; RowNo: integer;Exprn:String) Not Used. Maintained for backward compatability. SetTotalValue(TotalOrder: Numeric;ColumnName,Value :String) Set the given value as the total for the column given by ColumnName. Example : Consider an IView as follows Col1 Col2 Col3

A B C

1 3 5

20 40 60

Now assume that at the end of the report in Col2 the Column Avg has to be printed and in Col3 the column total has to be printed. This can be done by using the BefoePrintGT event. This event will be fired before printing the grand total. The column total will be available in expression sets in Tot<ColName> vars. To do this use the expression set given below. {BeforePrintGT} Av := TotCol2/3 SetTotalValue(0, {Col2}, Str(Av)) When the Grand total line is printed, the total for col2 will be changed to 3 (instead of 9). 127)SetCellFont(ColumnName, FontString) This will set the font for the given column. This can be used in expression sets to coditionally change the font of the cell. The FontString could any one of the following [b] - Bold [u] - Underline [i] - Italic Alternatively the FontString could be set as follows FontName=Arial,FontSize=10,FontStyle=[b],FontColor=clRed Example : Consider a report as follows Sales Man Target Actual Variance A B C 1000 1000 2000 900 400 1500 100 600 500

Assume that in the Variance column the amount should be displayed in Red Color in Arial Font if the variance is greater than 500. In the above table only the second row fourth column should be in this font. To acheive this requirement define an expression set as follows:

{BeforedisplayCol Variance} fstr := iif(variance>500, {fontname=Arial,fontsize=10,fontcolor=clRed}, {}) SetCellFont({Variance}, fstr) 128)SortIView(ColumnName, AscendingOrDescending) This function will sort an IView result in the ascending or descending order of the values in the given column name. This could be used in expression sets. 129)Filter(Filter Expression) This function will filter an IView that satisfies the given expression. The expression should return T or F. The expression can use any of the column values. 130)Group By(Column Name) This function groups the IView result based on the value in the given column. All rows that have the same value in the given column will be consolidated into one row 131)Hide Column(Column Name) Hides the given column in the IView. 132)Unhide Column(Column Name) UnHides the given column in the IView. 133)SetExtSequence(Transit, Fieldname, Prefix) This function can be used in an expression set to select sequences defined in other transactions. Note : The functions related to numbering sequence viz SetSequence & SetExtSequence cannot be used in OnFormLoad. Moreover, the case of the parameters should exactly match the ones defined in the tables. That is, if the field name is defined in lower case, the field name should be in lower case in these functions also. Example : The sequence defined in Purchase voucher can be used in Purchase Returns by calling this function in the expression set (for Purchase return voucher)

as SetExtSequence({vchpr}, {T1VchNo}, {Pur-}). 134)AddOption(Caption) Adds the given caption as a menu option. This will be available on Right Click. 135)EditColumn(Transid, ColumnName, Prompt) Allows user to edit a column in an IView. The Column to be edited is given in ColumnName. If the Transid is empty then the editing will not happen. 136)PostRecord(Transid:string; RecordId:Extended) This will post the current row in the IView into the TStruct given by Transid & record given by RecordId. The column names in the IView should be the same as the fields in the Tstruct.If recordid is zero, a new record will be posted. 137)SetColumnValue(ColumnName, Value) Sets the given value into the given column in the current row of an Iview. 138)PostRecord(TransId : String, RecordId:Numeric) Posts the current row in the IView into the given TStruct. The row will be stored into the Record given by the RecordId parameter. New records cannot be added using this option. 139)RefreshView(OnlyCompute) Refreshes the IView. If OnlyCompute is true, the IView only be re-computed and the SQLs will not befired. Example for AddOption, EditColumn, PostRecord, SetColumnValue, PostRecord AddOption({Edit Date}) {onclick Edit Date} EditColumn({try}, {DocDate}, {Enter date}) {AfterEdit DocDate} SetColumnValue({DocDate}, DocDate) PostRecord({try}, recordid) RefreshView() When the user clicks on Reconcile, a pop up window will appear and allow user to enter a date. On click of Ok button in the Pop Up window the AfterEdit event of dt will be executed. The SetColumnValue function will update the entered date into the IView. The PostRecord will post the updated value from the current row into the

the TStruct "try" into the record given by recordid. 140)GetStockAge(Itemid, Date, PeriodStr) This function can be used in an IView to get the age of the stock on hand. This is useful only if the valuation method is FIFO. Usage :Define an IView and get all the rows from the inventory master. Get the date on which the report is required as a parameter (named AsOnDate). Add a column named SAgewith expression as GetStockAge(LocInvDetailid, AsOndate, {0-30,31-60,61-90,91-9999}) The last parameter can be anything based on the user requirement. This function will make the resultant quantity in the given period in 4 different variables named Age_Qty1, Age_Qty2, Age_Qty3, Age_Qty4.Add four columns and set each of the above variables as column expression.DisplayTotal This is a system var. Set this variable F to suppress printing of a sub total. Example : If the total need not be printed if there is only line in the block then, this can be acheived by the following expression set. {BeforePrintSt 1} DisplayTotal := iif(Tot1RowCount > 1, {t}, {f}) Rowcount is a expression column in the IView with value = 1. 141)LastTotal This is a system var that will be set to true before printing the last total line. This can be used in expression sets. 142)Tot<ColumnName> This var will have column total. For every column in the IView, there will be a variable. Example : If there is a column named Amount, TotAmount will contain the column total. Tot<TotalNo><ColumnName> This var will contain the column with respect to any sub total. Each sub total is identified by the total number.

Example : Consider an IView as follows Col1 A A Tot-col2 A A Tot-col2 Tot-Col1 30 2 2 70 100 30 40 Col2 1 1 Col3 10 20

B 1 50 After printing each line the Tot variables will be updated. So, before printing the Tot-Col2 for the second time, the Tot2Col3 = 70 & Tot1Col3 = 100. 143)Group<ColumnName> This var will have the column value after grouping. This could be used to filter report based on grouped values. 144)OpenTransForm(Transcaption, Top, Left, Height, Width,

RecordId)
This function will open an input form related to a TStruct. The caption of the TStruct is given in Transcaption. The Top, Left, Height & Width parameters specify the window coordinates in which the input form should be opened. If RecordId is omitted an empty transaction form is displayed. In case recordid is provided, the transaction data is loaded in the transaction form. 145)RefreshField(FieldName) This function can be used in an expression set. This can be used to refresh the field values of the given field. In case, the field is calculated based on an expression. Any of the fields used in the expression are changed, the effect can be shown immediately on screen using this function in the onexit of the parent field. 146)SetTotalValue(TotalOrder: Numeric;ColumnName,Value:String) Set the given value as the total for the column given by ColumnName.

Example : Consider an IView as follows Col1 A B C Col2 1 3 5 Col3 20 40 60

Now assume that at the end of the report in Col2 the Column Avg has to be printed and in Col3 the column total has to be printed. This can be done by using the BeforePrintGT event. This event will be fired before printing the grand total. The column total will be available in expression sets in Tot<ColName> vars. To do this use the expression set given below. {BeforePrintGT} Av := TotCol2/3 SetTotalValue(0, {Col2}, Str(Av)) When the Grand total line is printed, the total forcol2 will be changed to 3 (instead of 9).

147)RegVar 148)Activerow

SYSTEM VARIABLES: 1)CompanyName:


Name of the company into which user has logged in. This is from control table.

2)UserName:
Name of User logged into the s/w.

3)UserCategory:
The Category under which the user is classified.

4)UserDepartment:
The department under which the user is classified.

5)DbRep:
Debit Representation in Financial system.

6)CrRep:
Credit Representation in Financial system.

7)ProfitPath:
The path in which P5RM is installed.

8)_MainCurr:
Main currency set for the project (Eg. Rupees, Dollars etc.)

9)_SubCurr:

Sub currency set for the project (Eg. Paise, Cents etc.)

10)_CurrDecimal:
Decimal defined for the project currency. 11)Finyrst: Financial year start date.

12)Finyred:
Financial year end date.

13)Afinyrst:
Used in case of extended financial period.

14)Afinyred:
Used in case of extended financial period.

15)_millions:
T if amount fields have to be represented in millions.

Sno. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Abs

Functions General Date Date General Date Date Date Date Date General General Date General Grid Grid Grid General General General General Date Date Date Date Date General AddToMonth AddToDate AmtWord cMonthYear CTOD DayOfDate DTOC DaysElapsed Eval FindAndReplace FormatDateTime GetInteger GetRcell GetRowCount GetMax IIF IsEmptyValue IsEmpty Lower LastDayOfMonth MandY YandM MakeDate MonthOfDate Power

Type

Status

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

Rnd Round Str Stuff SubStr Sum SumTill Time Total TimeElapsed Upper Val ValidEncodeDate YearOfDate GetValue Date GetOld Cell GetMin

General General General General General Grid Grid Date Grid Date General General Date Date Grid Date Grid Grid Grid

TSTRUCT FUNCTIONS:
1 2 3 4 5 6 7 8 9 10 11 HideFrame Setvalue MakeTreeId GetSqlValue SetProperty SetSequence ResetActiveComp LoadTempFile DeleteTempFile ActivateField AllowFrameChange General Grid,Non Grid NoDefFound Grid General Grid General Grid Grid Grid General

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

AllowFieldChange PrintDocNames ExecuteOptions RefreshFrame InitGrid GetOld GetOldId SQLRegVar CheckStock AllowedUserNames EnableButton GetSubTotal RoundedDiff SetSystemVar ExternalSave TrimVal GetLength FormatAmount FormatAccAmount FormatValue LeftPad Pad CurrAmtWord Lpad Rpad GetMod Trim FireSQL FindRecord SQLGet DPImport DPExport FixTree

Grid

Grid Grid Grid General General General General Grid Grid General General General General General General General General General General General General General General General General General General General General

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60)

PostMDMap Regenerate Repost PostGenMap GetTransId GetDelimitedStr CSVImport OpenDialog SaveDialog Xrun PlaceForm ReverseString Instr GetStockValue GetClosingStock RefreshField

General General General General General General General General General General General General General General General General

IVIEW FUNCTIONS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 GetCell GetRCell GetColNo GetRowno ComputePost SetCellFont SortIView Filter GroupBy HideColumn UnHideColumn SetExtSequence AddOption EditColumn PostRecord General Grid Grid Grid Grid Grid
Grid

Grid Grid Grid Grid

16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

SetColumnValue PostRecord RefreshView GetStockAge LastTotal Tot<ColumnName> Group<ColumnName > OpenTransForm SetTotalValue

Grid

General

Grid

System Variables
CompanyName UserName UserCategory UserDepartment DbRep CrRep ProfitPath _MainCurr _SubCurr _CurrDecimal Finyred Finyrst Afinyrst Afinyred _millions

Vous aimerez peut-être aussi