You can do it programmatically if you desire. Maybe easier than trying todo it through a grid
//SQL query
$sql = “SELECT emre.EMP_ID, emre.FIRST_NAME, emre.STATUS, emre.START_DATE FROM employee_reg emre”;
// Macro to execute the query
sc_select(ds, $sql);
// Check if the dataset contains any records
if (false !== {ds}) {
$xmlContent = “<?xml version='1.0' encoding='UTF-8'?>\n\n”;
// Iterate through the dataset till End Of File
while (!{ds}->EOF) {
$xmlContent .= "\t<employee>\n";
$xmlContent .= "\t\t<EMP_ID>" . htmlspecialchars({ds}->fields[0]) . "</EMP_ID>\n";
$xmlContent .= "\t\t<FIRST_NAME>" . htmlspecialchars({ds}->fields[1]) . "</FIRST_NAME>\n";
$xmlContent .= "\t\t<STATUS>" . htmlspecialchars({ds}->fields[2]) . "</STATUS>\n";
$xmlContent .= "\t\t<START_DATE>" . htmlspecialchars({ds}->fields[3]) . "</START_DATE>\n";
$xmlContent .= "\t</employee>\n";
{ds}->MoveNext();
}
{ds}->Close();
$xmlContent .= "</employees>";
// Define the path and filename for the XML file. You will see this gets saved in the root folder
$filePath = $_SERVER['DOCUMENT_ROOT'] . "/employees.xml"; // Adjust the path as needed
// Save XML content to the file if any records exist
if(file_put_contents($filePath, $xmlContent)) {
echo "YOur XML file has been created successfully.";
} else {
echo "Failed to create the XML file. Check permissions, Path and Privileges ";
}
} else {
echo “No data found.”;
}