Hello Timothy,
You can have the same application for all your customers, so basically the only thing that needs to change is the database. So same application but different database. When you give your customers a link to access the application you do this:
where CARMEN is the parameter that the Appeon application receives and that is the database that we want to connect to.
When the Appeon application opens, it connects to one database, the one that you specified in the DataSource on the Appeon Web Project, and that database is the one you choose to have information about all your customers. For example, in this database we have data that tells us if the customers has due invoices, or the number of Licenses that he has available with us.
So, in the PB application object you do something like this:
// connect to the database that you specified in the data source when you created the Appeon project.
CONNECT;
//**********************************************************
// get the name of the database that you want to connect
ls_database = CommandParm() // this function gets the parameter specified in the URL = ?carmen
//**********************************************************
// Then you get general information about this particular customer from the MAIN database of your system,
//***********************************************************
// After you are done getting this information about this particular customer, then you are ready to disconnect from this main database,
DISCONNECT;
//**********************************************************
// Now you can connect to the customer's database
// Imagine you have 500 customers, so instead of creating manually each data source in the AEM, you can create them dinamically
//************** Create a DataSource automatically
//************** The name of the DataSource in the AEM will be the same as the Database
gf_create_datasource( ls database ) // THIS FUNCTION IS DESCRIBED BELOW
sqlca = create transaction
SQLCA.DBParm = "CacheName='" + ls_database + "'"
SQLCA.dbms = "MSS" // microsoft sqlserver
connect;
// *** So at this point you are connected to your customer's database and you created the DataSource Dinamically
//**********************************************************************************************************************************************
//**********************************************************************************************************************************************
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FUNCTION gf_create_datasource ( as_database )
eon_str_connection lstr_con
appeondconfigdatasource luo_config
integer li_rc = -1
lstr_con.s_dbtype = 'sqlserver'
lstr_con.s_port = '1433'
lstr_con.s_server = '10.1.1.81'
lstr_con.s_username = "sa"
lstr_con.s_password = "usr"
lstr_con.s_commandtimeout = '0'
lstr_con.s_connectiontimeout = '0'
lstr_con.s_maxpool = '100'
lstr_con.s_minpool = '10'
lstr_con.s_usedynamicconn = 'false'
lstr_con.s_database = as_database
lstr_con.s_datasourcename = as_database
luo_config = CREATE appeondconfigdatasource
li_rc = luo_config.of_editdatasource(lstr_con)
if li_rc = 1 then
li_rc = luo_config.of_adddatasource(lstr_con)
if li_rc <> 0 then
return -1
end if
else
if li_rc <> 0 then
return -1
end if
end if
return 1