MS4BI®

MS4BI HELP 2022

by MS4script
01-Introduction
Preface & Copyright
Getting started
Informations + Cmd/param Server
Demos Simple
02- Declarations
Structure
Type
03- Instructions
Conditions if,do,while..
Char/Text functions Char or Text..()
Get + Include functions Get, Include..
String functions String# (hashtag)
Date-Time Day, Time, Year.
Display
Call
Formulas Complex
04- Database
Connector Ado, Odbc, Dsn, SAP, Ms4
DB Connect Create, delete
Import DataSource Import, Consolidation
Administration Admin, User
05- Sql-Query
Sql
Query Form : BTS,Plus
Grid option
06- Charts
Forms Plus, Win, Image, Excel, Morris...
Pie Std, Donut, 3D...
Bar Std, Stack, Line, Area, Plot
Radar
QrCode, Gauge
Step, Stock...
,Google,Leaflet... GeoMap
,Gantt,Timeline,Org.
DrawWindow [web]
07- Dashboard
Form tab, no tab
Responsive UI
08- Report
Report Hierarchy
Report Design
09- Filters
Dialogue + Call
10- Menus
Menu Design
Menu Frameset
Menu Custom
11-UI : Responsive
Tables Responsive,Frame,position
List Group
Text
Panel Header, body, Footer
Button Button, Progress Bar
Icon & Button
Collapse Group, Panel
Notifications
12- Encryption
Encrypt
Decrypt
13- Windows
Dialogue
Picture, Frame, Button..
MsgBox
Grid

Designer

00-OverView
01-Transaction
02-Setting
05-Import
10-Formula
15-Report-Part1
16-Report-Part2
20-Query-Part1
21-Query-Part2
25-Report-Query-Style
30-QrCodeImage
31-Windows
32-Frame
40-TabStrip
50-Collapse
60-BeginForm
63-Input-SubmitBox
70-Input-Select
71-Input-Insert
72-Input-Update
73-Input-Delete
75-Input-Query
77-ListComBo
81-Button-Link
82-Button-DataList
86-Sticky-Label
91-Insert-PhpJsHtml
92-Insert-MS4script
15- Css, html, Php, js.
Insert Native language Begin_sw..End_Sw
16-Install + tools.
Installation & Configuration This Menu
Generate Native... Php, Html, js..
Code Generator Ms4 Script
MarkDown Ms4 Script
Source Code Menu Help This Menu
written with ms4script
      

BASIC HELP : MS4BI by MS4script

2022 version 1.10

Chapter 4 : DATABASES

KEYWORD : DBCONNECT

:

Definition

- connects databases with MS4,ADO or ODBC data sources

Syntax

  		 
			DBConnect{Driver}(string DB Name ) ;
 	

Example 1 MS4 DB

  		
<-local pc>   
    text : Lcurrentdb :="#DRIVERSYS+\MANDRAGOREPLANETE\MS4BI\01-GETTING-STARTED-UNICODE\ms4bilangConso.db" ; 
    or
   <-local server>
   text : Lcurrentdb :="#WWWMS4BISERVER+\ms4bilangConso.db" ; 
   DBconnect {Ms4DB} (Lcurrentdb); 
  FormPlus : DrawGrid, title :"MS4 DB : ms4LangConsolidation China/Japan : Relation -> ?? = b.city  " 
  use   View  ("[ms4LangConsolidation]")  ;


	

Example 2 ADO DB

  
 DBConnect{Ado:"xls"}( LFile1Excel);
     display "insert Table Japanese : CONSOLIDATION 1  ";
       Ms4_SQL{Ado:"xls"}(" SELECT  * into " + " %s " + "  from  [中国最大の都市のリスト$] ", Table1SheetJapanese) return x ;
 	 

Remarks

DRIVER :
MS4
ODBC
ADO :string : the ADO connectors must be present in the directory :

driver:\MandragorePlanete\MS4BI\zDriversADO

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv

KEYWORD : DBEXIST

:

Definition

- Tests if an MS4 DB, ADO or ODBC database is present.

Syntax

  		 
			 DBexist{Driver}(string DB Name )  return integer ;
 	

Example

  		   
    DBexist(Lcurrentdb) return (X) ;
	if (x not_void ) then
 		Display " DB exists   Ok : DELETE !!   " ,Lcurrentdb Column 40;
		....
	ELSE
		  Display "DB   not found   :  ",Lcurrentdb;  
	 
	End_if ;
	  


	

Remarks

integer : returns TRUE (1) if present, otherwise FALSE (0)
not_void = TRUE void = FALSE

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : DBDELETE

:

Definition

- Deletes an MS4 DB database.

Syntax

  		 
			DBDelete{Driver}(string DB Name ) ;
 	

Example

  		   
    DBexist(Lcurrentdb) return (X) ;
	if (x not_void ) then
 		Display " DB exists   Ok : DELETE !!   " ,Lcurrentdb Column 40;
		DBDelete{MS4DB}(Lcurrentdb);
	ELSE
		  Display "DB   not found   :  ",Lcurrentdb;  
	 
	End_if ;
 
	

Remarks

Only applies to the MS4DB driver
not_void = TRUE void = FALSE

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : DBCREATE

:

Definition

- Creates an MS4 DB database.

Syntax

  		 
		 DBCreate{Driver}(string DB Name ) return integer (optional);
 	

Example

  
 <-local pc>   
    text : Lcurrentdb :="#DRIVERSYS+\MANDRAGOREPLANETE\MS4BI\01-GETTING-STARTED-UNICODE\ms4bilangConso.db" ; 
    or
   <-local server>
   text : Lcurrentdb :="#WWWMS4BISERVER+\ms4bilangConso.db" ; 
   
    DBexist(Lcurrentdb) return (X) ;
	if (x  void ) then
   		  Display "DB   not found   :  ",Lcurrentdb;  
	   DBCreate{MS4DB}(Lcurrentdb) return (X) ;
	End_if ;
 
	

Remarks

Only applies to the MS4DB driver.
integer : returns TRUE (1) if there is a problem, otherwise FALSE (0)
not_void = TRUE void = FALSE
Preferably use a local server to define your database with "#WWWMS4BISERVER+\yourdbname"
You can define your database in a directory on your computer.
Problem: when exporting source code to an https server, the location of the database needs to be edited

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : DBCLOSE

:

Definition

- Closes an MS4 DB database.

Syntax

  		 
			 DBClose{Driver}(string DB Name ) return integer (optional);
 	

Example

  
   text : Lcurrentdb :="#DRIVERSYS+\MANDRAGOREPLANETE\MS4BI\01-GETTING-STARTED-UNICODE\ms4bilangConso.db" ; 
    
    DBexist(Lcurrentdb) return (X) ;
	if (x  not_void ) then
   		  Display "DB    found   :  ",Lcurrentdb;  
	  DBCLose{MS4DB}(Lcurrentdb) return (X) ;
	End_if ;
 
	

Remarks

Only applies to the MS4DB driver.
integer : returns TRUE (1) if there is a problem, otherwise FALSE (0)

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : DBBACKUP

:

Definition

- Copy/Backup an MS4 DB database.

Syntax

  		 
			 DBBACKUP{MS4DB}(string path + DB Name src ) to  (string path + DB Name dest ) return integer (optional);
 	

Example

  
 
Char : LCurrentDir:256, LcurrentDirdb_src :256 ,LcurrentDirdb_dest :256  ;
 integer : yes :=1,msgsql;
Getcurrentdir(LCurrentDir);
str_format( LcurrentDirdb_src,"%s\Ms4BI-DemoExcelCube.db",LCurrentDir);
str_format( LcurrentDirdb_dest,"%s\Ms4BI-DemoExcelCube_backupex.db",LCurrentDir);
 ** pc 
 DBBackup{Ms4db}  (LcurrentDirdb_src) to  (  LcurrentDirdb_dest) return (msgsql);
  if(msgsql= 1)
  then
  display "ok   local  PC backup";
  else
  display "ko  local  PC  backup";
  end_if;
  
  ** server   
 DBBackup{Ms4db}("#WWWMS4BISERVER+\Ms4BI-DemoExcelCube.db") to (  "#WWWMS4BISERVERBACKUP+\Ms4BI-DemoExcelCube.db") return (msgsql);
  if(msgsql= 1)
  then
  display "ok   local WEB backup";
  else
  display "ko  local WEB  backup";
  end_if; 
  
  enter; 
	

Remarks

Only applies to the MS4DB driver.
integer : returns FALSE (0) if there is a problem :backup ko, otherwise TRUE (0) backup Ok

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : TABLEEXIST

:

Definition

- Tests if an MS4 DB table or a file is present.

Syntax

  		 
			TableExist (string file Name ) return integer  ; 
or TableExist{Driver}(string DB Name ) return integer ;

Example 1 FILE

  
 	Concatene  LCurrentDir,"\japaneseExample.xls"     into  Lfile1Excel;
 	Tableexist(Lfile1Excel) return (X) ;
	if (x not_void ) then
              Display " Table Ok : continue  " ,Lfile1Excel Column 40;
	ELSE
               Display "Table not found : database problem !! ",Lfile1Excel;  
	Exit;
	End_if ;
 
	

Example 2 MS4 DB

 	
 	BEGIN
		DBconnect{Ms4db}( LEnvSQLDB);
		Tableexist{Ms4db}("ItabOrder") Return  ( msgsql) ;
		/* 2 return codes : TRUE or FALSE */
 
		if ( msgsql = TRUE) then
		  Ms4_SQL{Ms4db}(  "DROP TABLE  ItabOrder   ");  
			Display " Dropping Table ItabOrder!!";
		else 
 		Display " Table ItabOrder does not exist !!";
		End_if;        
        END;

Remarks

integer : returns TRUE (1) if present, otherwise FALSE (0)
not_void = TRUE void = FALSE

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : VIEWEXIST

:

Definition

- Tests for the presence of an MS4 DB view.

Syntax

  		 
			ViewExist{Driver}(string DB Name ) return integer  ;
 	

Example

 	
 BEGIN      ** DB Connect ..    	
              DBconnect{Ms4DB}(LEnvDemoExcelDB);
		 ViewExist{Ms4DB}("ReportTotalID") Return  (msgsql) ;
		/* 2 return codes : TRUE or FALSE */
  
		if ( msgsql = TRUE) then
			Ms4_SQL{Ms4DB}(  "DROP VIEW  ReportTotalID   "); 
		end_if; /* create a new view */
		Ms4_sql{Ms4DB} (" CREATE  VIEW ReportTotalID  as " +
				" select DISTINCT orderID ,employeeid,LastName ,productID,unitprice," +  
                               "  strftime('%Y',orderDate)  as YEARBUSINESS " +
                                "   from  [ms4EmplConsolidationBusiness]   " +
				"  order by  YEARBUSINESS,employeeID,shipcountry ,orderID "); 
END;        
 

Remarks

Only applies to MS4 DB.
integer : returns TRUE (1) if present, otherwise FALSE (0)
not_void = TRUE void = FALSE

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : EXPORT_TABLE

:

Definition

- Exports all tables and views for an MS4 DB database in EXCEL, CSV, TXT, HTML, XML format.

Syntax

  		 
			Export_table(string DB Name )    ;
 	

Example

 	
     BEGIN  
 		DBexist{Ms4DB}(LEnvDemoExcelDB) return (X) ;
		/*   return codes */
		** x = 1 : Ok , x = 0 Not ok */
		 if (x void) then
                  Display "DB not found ", LEnvDemoExcelDB; 
				  enter;
				  Exit;
                 End_if;
     END;
		Display " Ms4 Script------------------------------------>Cube : ";
		Display " Export All Tables  : ",LEnvDemoExcelDB;
		Display " Ms4 Script-------------------------------------------> ";
  		       BEGIN **   
	 			    Export_Schema (LEnvDemoExcelDB);
				END;
		Display " End : Go to   :\MandragorePlanete\MS4BI\Ms4BiServer\www\mandragorechart ";
    
 

Remarks

Only applies to MS4 DB
- Exports Excel, txt, html, xlm files to: \MandragorePlanete\MS4BI\Ms4BiServer\www\mandragorechart

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, Sql_DestroyEnv



KEYWORD : EXPORT_SCHEMA

:

Definition

- Exports all table schemas from an MS4 DB database in HTML format

Syntax

  		 
			Export_schema(string DB Name )    ;
 	

Example

 
       BEGIN   
 		DBexist{Ms4DB}(LEnvDemoExcelDB) return (X) ;
		/*   return codes */
		** x = 1 : Ok , x = 0 Not ok */
		 if (x void) then
                  Display "DB  not found ", LEnvDemoExcelDB; 
				  enter;
				  Exit;
                 End_if;
        END;
		Display " Ms4 Script------------------------------------>Cube : ";
		Display " Export All Tables  : ",LEnvDemoExcelDB;
		Display " Ms4 Script-------------------------------------------> ";
  		              BEGIN **   
	 			    Export_Schema(LEnvDemoExcelDB);
				END;
		Display " End : Go to   :\MandragorePlanete\MS4BI\Ms4BiServer\www\mandragorechart ";
    
 

Remarks

Only applies to MS4 DB
- Exports schemas to an html file in : \MandragorePlanete\MS4BI\Ms4BiServer\www\mandragorechart

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



KEYWORD : Sql_DestroyEnv

:

Definition

- Destroys the connection environment and SQL for MS4 DB, ADO, ODBC databases.

Syntax

  		 
			Sql_DestroyEnv()    ;
 	

Example

 
       BEGIN   
 	DBconnect{Ado:"xls"}(LcurrentDirExcel);
		Ms4_Query: Web {Ado:"xls"}("SELECT * FROM [viewInvoices$]   " );
 
		Sql_DestroyEnv();
        END;
	 

See also

IMPORT NEW DB, DBEXIST, DBCREATE, DBCONNECT, DBDELETE,DBCLOSE,DBBACKUP,TABLEEXIST,VIEWEXIST, MS4_SQL, EXPORT_TABLE, EXPORT_SCHEMA, Sql_DestroyEnv



Interested in joining us? contact@mgplanete.com
The Mg Planete team


Copyright 2022 by Mandragore Planete

the official sites :
mgplanete.com
getms4bi.com
demos.ms4bi.com
help.ms4bi.com
ms4script.com

Download

official site :
getms4bi.com

Our purpose : Keep it simple !


written with ms4script
  • help 01.010.2022.8

MS4BI in 5 minutes