QScript code can be used for generating warning messages based on a specified condition.
Method
The below example demonstrates the use of the function getVariableByName()
to check whether or not a data file contains a particular variable. If the variable named does not exist, then the function returns the value null and produces a warning message.
// This pops up a message if the data file does not contain a variable with the name 'weight'.
// You could expand this out to make a script that checks whether new data files have been outfiled correctly by your supplier.
if (project.dataFiles[0].getVariableByName("weight") == null)
alert("Data file does not contain a variable called 'weight'.");