存档

2010年1月 的存档

C/FRONT Programming: How to Retrieve a C/SIDE Database Record

2010年1月24日 没有评论

Hi,

For those of you who are just starting out in C/FRONT, here are two functions that you can use to find records in the database: (Note that you will need to be familiar with the C Language to read the samples)

1. DBL_FindRec – a function that locates a record that contains given values in the fields of the current keys, and copies it to a buffer.

2. DBL_NextRec – a function that uses the current sorting sequence to retrieve a record in the table relative to a specified record, and then copies it to a buffer.

Here is a code snippet that shows you how to use DBL_FindRec and DBL_NextRec:

————-start—————o0o—————o0o—————o0o—————o0o—————o0o—————

DBL_HTABLE hTable;

DBL_HREC hRec;

/* … */

/* Allocate memory for the record buffer */

hRec = DBL_AllocRec(hTable);

/* Let DBL_FindRec return error if not present */

DBL_Allow(DBL_Err_RecordNotFound);

/* Find the first record */

if (DBL_FindRec(hTable, hRec, “-“))

{

do

{

/* … */

/* Get the next record */

} while (DBL_NextRec(hTable, hRec, 1));

}

DBL_FreeRec(hRec);

/* … */

—————end—————o0o—————o0o—————o0o—————o0o—————o0o—————

The formal syntax for DBL_FindRec is…

DBL_BOOL DBL_FindRec(DBL_HTABLE hTable, DBL_HREC hRec, DBL_U8* SearchMethod);

where:

hTable –> is the handle to the table.

hRec   –>  As input: is the record from which the search will begin.

           –>  As output: is the Record that is found.

           –>  Any FlowFields associated with the record are set to zero; you can use DBL_CalcFields to update

                  these fields.

SearchMethod –> is a string with one or more of these operators:

=   find record equal to hRec

<   find record less than hRec

>   find record greater than hRec

–    find first record in table

+   find last record in table

NULL means the same as =

Note that an operator can only occur once. The operators + and – must be used alone. If SearchMethod contains any of the operators =, > or <, values must be assigned to all the fields of the current key and the primary key in hRec before making this call.

DBL_FindRec retrieves the first record that meets the criteria set by SearchMethod and the scope of any filters associated with the table handle (set by DBL_SetFilter/Range). The order in which the records are scanned is determined by the current key of the table handle (set by DBL_SetCurrentKey).

The search starts from the values in the current key fields in hRec. If the current key is not the primary key, there is a chance that several records will have the same values in their current key fields. In such case, the values in the primary key fields of hRec are also used in the search.

If a record is found, 1 is returned. If a record is not found, two things can happen:

1. If this result is allowed by DBL_Allow(DBL_Err_RecordNotFound), 0 is returned.

2. If the result is not allowed, the function will raise an exception and call the exception handler with an error.

Here is another sample code snippet when using DBL_FindRec:

————-start—————o0o—————o0o—————o0o—————o0o—————o0o—————

DBL_HTABLE hTable;

DBL_HREC hRec;

DBL_Init();

DBL_OpenDatabase(“test.fdb”, 2000, 0);

DBL_OpenCompany(“Test Company”);

DBL_OpenTable(&hTable, 15);

hRec = DBL_AllocRec(hTable);

/* Look up record matching hRec */

/* Causes an exception if hRec does not exist in table 15 */

DBL_AssignField(hTable,hRec,1,DBL_FieldType(hTable,1),”100″,strlen(“100″));

DBL_FindRec(hTable, hRec, (DBL_U8*)”=”);

/* Look up record equal to or greater than hRec */

/* Causes an exception if such a record does not exist */

DBL_AssignField(hTable,hRec,1,DBL_FieldType(hTable,1),”100″,strlen(“100″));

DBL_FindRec(hTable, hRec, (DBL_U8*)”=>”);

/* Look up first record */

/* Causes an exception if table 15 is empty */

DBL_FindRec(hTable, hRec, (DBL_U8*)”-“);

/* Look up last record */

/* Causes an exception if table 15 is empty */

DBL_FindRec(hTable, hRec, (DBL_U8*)”+”);

DBL_FreeRec(hRec);

DBL_CloseTable(hTable);

DBL_CloseCompany();

DBL_CloseDatabase();

DBL_Exit();

—————end—————o0o—————o0o—————o0o—————o0o—————o0o—————

Now the syntax for DBL_NextRec goes like this…

DBL_S16 DBL_NextRec(DBL_HTABLE hTable, DBL_HREC hRec, DBL_S16 Step);

where:

hTable  –>  is the handle to the table

hRec    –>  As input: is the record from which the search will begin.

            –>  As output: is the record that is found.

            –>  Any FlowFields associated with the record are set to zero; you can use DBL_CalcFields to update

                   these fields.

Step    –>  is the number of steps.

           –>  if Step=0, the function has no effect. For backward movement through the table, use a negative

                  number.

DBL_NextRec locates a record that is positioned a given number of steps before or after hRec. Movement through the table is governed by the filters and by the current key that is associated with the table handle. All of the fields in hRec which will be compared to the current key must contain relevant values before this function is called.

The function returns the number of records that have been scanned which meet the criteria set by any filters, given the current key. This value can be closer to zero than Step, depending upon the number of records in the table. If the table is empty, zero is

returned and hRec remains unchanged.

Here now is an example of using this function…

————-start—————o0o—————o0o—————o0o—————o0o—————o0o—————

DBL_HTABLE hTable;

DBL_HREC hRec;

DBL_Init();

DBL_OpenDatabase(“test.fdb”, 2000, 0);

DBL_OpenCompany(“Test Company”);

DBL_OpenTable(&hTable, 15);

hRec = DBL_AllocRec(hTable);

/* Scan all records in table 15 in ascending order */

DBL_Allow(DBL_Err_RecordNotFound);

if (DBL_FindRec(hTable, hRec, (DBL_U8*)”-“))

do

{

} while (DBL_NextRec(hTable, hRec, 1) != 0);

/* Scan all records in table 15 in descending order */

DBL_Allow(DBL_Err_RecordNotFound);

if (DBL_FindRec(hTable, hRec, (DBL_U8*)”+”))

do

{

} while (DBL_NextRec(hTable, hRec, -1) != 0);

DBL_FreeRec(hRec);

DBL_CloseTable(hTable);

DBL_CloseCompany();

DBL_CloseDatabase();

DBL_Exit();

—————end

分类: C/AL 标签:

快速输入日期数据

2010年1月24日 没有评论

Date类型数据可以按照下面方式来输入:

1. w : workdate 工作日期

2. t : system date 系统当前日期

3. c: closing date 关帐日期

4.m : Monday  第几周的星期1.   m1..m5, 表示第一周到第五周

(tu 表示周2,w表示周3,th表示周4,f表示周5,sa表示周6,su表示周日,   m1..su1表示今年的第一周)

5. p: Period   第几个期间. p1表示会计期间1.

 

分类: General 标签: ,

销售发票-发货-订单行的Link关系

2010年1月24日 没有评论

Sales Invoice的过账交易,将记录在Value Entry中.

在Value Entry中, 可以直接通过Sales Invoice Line的Document No. / Line No. 直接得到Value Entry的Entry No.

注意, 有可能有多条Value Entry

通过Value Entry找到对应的Item Ledger Entry No.

Value Entry上有对应的Item Ledger Entry No.

在Item Ledger Entry中找对应的Type是Sales Shipment.

然后通过Document No. / Line No. Get到对应的Sales Shipment Line中的收货行

这就是 销售发票–>销售发货–>销售行的链接

采购发票-收货-订单行的Link关系

2010年1月20日 没有评论

Purchase Invoice的过账交易,将记录在Value Entry中.

在Value Entry中, 可以直接通过Purchase Invoice Line的Document No. / Line No. 直接得到Value Entry的Entry No.

注意, 有可能有多条Value Entry

通过Value Entry找到对应的Item Ledger Entry No.

Value Entry上有对应的Item Ledger Entry No.

在Item Ledger Entry中找对应的Type是Purchase Receipt.

然后通过Document No. / Line No. Get到对应的Purch. Rcpt. Line中的收货行

这就是 采购发票–>采购收货–>采购订单行的链接

fin.exe/finsql.exe 启动参数列表

2010年1月10日 没有评论

id

temppath

testmode

showhelpid

sealstx

dbtest

debug

servername

database

dbreadonly

cache

commitcache

company

objectcache

nettype

coveragefilename

coveragelog

url

noseh

runasupas

testtarget

breakpoints

servertype

ntauthentication

userportalpipename

userportalsocketport

appservername

startupparameter

installasservice

uninstallasservice

appservertype

target

view

position

requestform

forcenewinstance

Saludos

分类: Installation 标签: ,