From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

GPI extension : how to get and set data parent object

Hi !

GPI extensions again.

How can I get and set the following Diadem data channel properties variables :
Data source type, Data source name, Original file path, Original file and Parent object.

Is there any documentation or recommendations for using these variables.

I've search lDataProperties service routine capabilities, but I fail.

Thanks for your help.

JMA.
0 Kudos
Message 1 of 3
(3,808 Views)
Hi JMA,

Below you will find the GPI-DLL code to set the 7 new channel properties which shipped with DIAdem 8.1:

FILE "AdditionalChannelVars.h"
// To set the 7 new (Jan.2002) channel variables:
// - ChnSourceType name of file filter GPI driver
// - ChnParentName plain file name without extension
// - ChnFileName plain file name with extension
// - ChnFilePath path (drive + directory) without file name
// - ChnInstanceKey index of the channel
// - ChnSourceHandle 0
// - ChnSourceName "" (empty string)
//
//
void SetAdditionalChannelVars (long hChannel, long kan);
// hChannel is the channel handle (integer)
// kan is a channel number to go into variable ChnInstanceKey


FILE "AdditionalChannelVars.cpp":
// To set the 7 new (Jan.2002) channel variables:
#include "gpitype.h" // General macros and types of the DLL user interface
#include "datatype.h" // DATA user interface special types and defines
#include "datafct.h" // DATA user interface prototypes
#include "gpifct.h" //
#include "AdditionalChannelVars.h"
#include "afxpriv.h" // for USES_CONVERSION and A2W

extern CString sgDataPathName; //comes from function "fLoad"

void SetAdditionalChannelVars (long hChannel, long kan)
{
long nnn; // to set 7 new channel variables
char szDrv[_MAX_DRIVE];
char szDir[_MAX_DIR];
char szNam[_MAX_FNAME];
char szExt[_MAX_EXT];
char szNamExt[_MAX_FNAME+_MAX_EXT];
char szDrvDir[_MAX_DRIVE+_MAX_DIR];
_splitpath(sgDataPathName,szDrv,szDir,szNam,szExt);
strcpy(szNamExt,szNam); //name
nnn=strlen(szNamExt); //extension
strcpy(&szNamExt[nnn],szExt); //name + extension
strcpy(szDrvDir,szDrv); //drive
nnn=strlen(szDrvDir); //directory
strcpy(&szDrvDir[nnn],szDir); //drive + directory

char szFileDriver[256];
strcpy(szFileDriver,"GPIFileDriver");
nnn = nDIAdemVarGet(szFileDriver,256);

char szInstKey [8];
char szSourceHandle [8];
char szSourceName [8];
sprintf (szInstKey,"%ld\0",kan);
strcpy (szSourceHandle,"0");
szSourceName[0]=0;

//Variables shall be set below by:
USES_CONVERSION;
nnn=lDataProperties(eDataObjParentNameSet,hChannel,0,A2W(szNam));
nnn=lDataProperties(eDataObjFileNameSet,hChannel,0,A2W(szNamExt));
nnn=lDataProperties(eDataObjFilePathSet,hChannel,0,A2W(szDrvDir));
nnn=lDataProperties(eDataObjSrcTypeSet,hChannel,0,A2W(szFileDriver));
nnn=lDataProperties(eDataObjInstanceKeySet,hChannel,0,A2W(szInstKey));
nnn=lDataProperties(eDataObjSrcHandleSet,hChannel,0,A2W(szSourceHandle));
nnn=lDataProperties(eDataObjSrcNameSet,hChannel,0,A2W(szSourceName));
}

Hope it helps,
Brad Turpin
NI
0 Kudos
Message 2 of 3
(3,808 Views)
Hi Brad,

I think it will work, but now I've another linked problem.

Theses new variables comes with new API functions (nDIAdemVarGet) and new enumeration values (eDataObjSrcNameSet...).

There must be new versions of Diadem GPI include files, but I don't know where to find them.

Thanks.

JMA
0 Kudos
Message 3 of 3
(3,808 Views)