private void RefreshOutputORDataset(string objectname, CommandRequest cmd, string originalCommand, OutputWindow ow)
{
UAMenuCommand uamc = new UAMenuCommand();
cmd.CommandSyntax = "is.null(" + objectname + "$BSkySplit)";//$BSkySplit or $split in return structure
if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: Executing : " + cmd.CommandSyntax, LogLevelEnum.Info);
// is it just a list(non Bsky) or its a list that contains tables (user tables or Bsky Stat result tables)
bool isNonBSkyList = false;
object isNonBSkyListstr = analytics.ExecuteR(cmd, true, false);
if (isNonBSkyListstr != null && isNonBSkyListstr.ToString().ToLower().Equals("true"))
{
isNonBSkyList = true;
}
if (isNonBSkyList)
{
string ewmessage = "This Object cannot be formatted using BSKyFormat. BSkyFormat can be used on Array, Matrix, Data Frame and BSky List objects only.";
SendErrorToOutput(ewmessage, ow);//03Jul2013
return;
}
if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: $BSkySplit Result (false means non-bsky list): " + isNonBSkyList, LogLevelEnum.Info);
cmd.CommandSyntax = objectname + "$uasummary[[7]]";
if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: Executing : " + cmd.CommandSyntax, LogLevelEnum.Info);
string bskyfunctioncall = (string)analytics.ExecuteR(cmd, true, false);//actual call with values
if (bskyfunctioncall == null)
{
bskyfunctioncall = ""; //24Apr2014 This is when no Dataset is open. And Syntax editor is open.Not returning, instead putting blank.
}
if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: $uasummary[[7]] Result : " + bskyfunctioncall, LogLevelEnum.Info);
string bskyfunctionname = "";
if (bskyfunctioncall.Length > 0)
{
if (bskyfunctioncall.Contains("("))
bskyfunctionname = bskyfunctioncall.Substring(0, bskyfunctioncall.IndexOf('(')).Trim();
else
bskyfunctionname = bskyfunctioncall;
}
uamc.commandformat = objectname;// object that stores the result of analysis
uamc.bskycommand = bskyfunctioncall.Replace('\"', '\'');// actual BSkyFunction call. " quotes replaced by '
uamc.commandoutputformat = bskyfunctionname.Length > 0 ? string.Format(@"{0}", BSkyAppData.BSkyDataDirConfigBkSlash) + bskyfunctionname + ".xml" : "";//23Apr2015
uamc.commandtemplate = bskyfunctionname.Length > 0 ? string.Format(@"{0}", BSkyAppData.BSkyDataDirConfigBkSlash) + bskyfunctionname + ".xaml" : "";//23Apr2015
uamc.commandtype = originalCommand;
CommandExecutionHelper auacb = new CommandExecutionHelper();
if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: CommandExecutionHelper: " , LogLevelEnum.Info);
auacb.ExecuteSyntaxEditor(uamc, saveoutput.IsChecked == true ? true : false);//10JAn2013 edit
auacb = null;
}