LogiView

Function 'sel_string'

     

This function is used to read a database value. The corresponding database field must be the type "String".

This command allows long-text fields.
If the function is called using the Where clause "actual', LogiView tries to read the table field value from the current mask.

If the number of values which are returned by the where clause is unknown, it is possible to call sel_value(count) and proceed with the programming depending on the result. If the result > 1 , an array must be read-in.

Example:
RES=sel_value(count({FLD}),{WHERE|actual})
if(RES==0)
   put("No result")
elseif(RES==1)
  {DAT_VAR}= sel_string({FLD},{WHERE|actual})else
else
  {DAT_VAR}= sel_string({FLD},{WHERE|actual})else
endif

OR:

If the number of values which are returned is >1, the returned number of found records is stored in REC_NR.

Example:

ART_S=sel_string ("T_MASTER_DAT.PART_ID", "T_MASTER_DAT.PART_ID"="screw%",REC_NR)
(Variable declaration: ART_S = string variable / REC_NR = integer variable)

 

Syntax:

 

{STR_VAR}= sel_string({STR_EXPR},{WHERE|actual}) or
{STR_VAR}=sel_string({STR_EXPR},{WHERE},{INT_VAR}) or
{STR_VAR}= sel_string(act_fld)

 

I/O parameters:

{STR_EXPR} Name of a table field in the format "table name.column name".
{WHERE|actual} Where clause followed by the database access.
{INT_VAR} Number of found records.
act_fld

The keyword "act_fld" defines the access to the current (mask) field without the necessity to know its name. "Act_fld" represents a unique and complete Where clause; therefore, using further Where clauses is excluded.

"Act_fld" can only be used if LogiView is called as "pre-field" or "post-field" userexit.

  In this case no database access is necessary. However, the mask contents may vary from the actual database contents unless an update was performed just before.
-  
 

Return value:

 
{STR_VAR} Value read from the database.
 

Example:

  Declaration of Variables
 
10 if (sel_string(act_fld)== ""))

20   put_mes("EDB-BAS-USR-UIC-ERR","200-999")

30   exit()

40 else

50   ..

90 endif

Functions and commands: DB/Mask Interface