Re: RE: RE: OW Interoperability w/Access
If you don't need the selection to be really dynamic then just set up a bunch of versions to cover your bases. Then, simply call the appropriate version at run-time.
Now, if you need 'on the fly' dynamic data selection, then I don't know how to do that in C. Give me a few hours to scour the inclusion files and I bet I could figure it out, but that seems to be counter productive. You should change the UBE to update it's data selection at run-time.
Thusly:
Add a data structure to the report. In the Initialize section append data selection commands that utilize the structure values. You can condition the 'appends' to be ignored if anything else calls the report. I know, I know, you didn't want to change the report. . .well, sometimes you have to do things the 'easy way'.
Now right a C program using the Interconnectivity stuff I mentioned in that other thread. That shows you how to log in and out of OW and how to get the environment 'handles.'
Now call jdeLaunchUBEEx to execute your UBE (I stole this out of B4200310)
/************************************************************************
* Variable and Structure Declarations
************************************************************************/
PUBEVAR pUbeVar = (PUBEVAR)NULL;
DSRI375782 ds42997; /* Data Structure for R42997 */
LPF42UI01 lpdsF42UI01 = lpds4200310D->lpdsF42UI01;
/************************************************************************
* Main Processing
************************************************************************/
pUbeVar = jdeAlloc(COMMON_POOL, sizeof(struct tagUBEVAR),MEM_ZEROINIT);
if (pUbeVar != (PUBEVAR)NULL)
{
memset((void *)pUbeVar, (int)'\0', sizeof(pUbeVar));
/*--------------------------------------------------------------------
* Load Ube Structure
*-------------------------------------------------------------------*/
pUbeVar->bPreview = FALSE;
jdeNIDcpy((char *)pUbeVar->szReport,(const char *)"R42997");
if (IsStringBlank(lpds4200310D->szPOR42997Vers))
{
strcpy((char *)pUbeVar->szVersion, (const char *)"ZJDE0001"); /* CHG 2830649 */
}
else
{
strcpy((char *)pUbeVar->szVersion, (const char *)lpds4200310D->szPOR42997Vers);
}
strcpy((char *)pUbeVar->szMachineKey, (const char *)lpDS->szCMComputerID);
GetLocalEnvironmentName(pUbeVar->szEnhv, 11);
pUbeVar->idRunTime = (GLRTID)lpBhvrCom->hDlg << 16;
/*--------------------------------------------------------------------
* Run the UBE Asynchronously
*-------------------------------------------------------------------*/
pUbeVar->bSynchFlag = FALSE;
/*--------------------------------------------------------------------
* Run the UBE in Batch Mode
*-------------------------------------------------------------------*/
pUbeVar->bBatchFlag = TRUE;
/*--------------------------------------------------------------------
* Load R42997 Structure
*-------------------------------------------------------------------*/
memset((void *)&ds42997, (int)'\0', sizeof(ds42997));
MathCopy(&ds42997.mnSalesOrderNumber, &lpdsF42UI01->zhdoco);
strcpy((char *)ds42997.szSalesOrderType, (const char *)lpdsF42UI01->zhdcto);
strcpy((char *)ds42997.szSalesOrderCompany, (const char *)lpdsF42UI01->zhkcoo);
/*--------------------------------------------------------------------
* Launch the Ube
*-------------------------------------------------------------------*/
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)&ds42997,
lpBhvrCom);
}
It's cake, allocate and initialize the pUbeVar structure. Fill it with the stuff you see up there; report name, version, how to run it, etc. Just copy that stuff and replace your report name. You'll be fine.
Next you initialize and fill the data structure. If you don't want to go with a structure, just skip that part and send NULL in the third parm of jdeLaunchUBEEx.
Lastly, call jdeLaunchUBEEx with all the pieces and logout.
If you don't use the report structure call the function like this:
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)NULL,
lpBhvrCom);
Between this thread, and the one where I show how to sign-on and off, you have almost the whole program. Write it up, and attach the monster to your VB proggy. (homer)mmmmmm. . . .caaaaaake(/homer)
Darren Ricciardi - OneWorld Whipping Boy
Looking for work in Amsterdam THE NETHERLANDS