예제 #1
0
 public static object[,] GetResults([ExcelArgument(Description = "The name of the results object as returned by a call to another QuantSA function")] string objectName,
                                    [ExcelArgument(Description = "The name of the result required.  Use QSA.GetAvailableResults to get a list of all availabale results in this object.")] string resultName)
 {
     try
     {
         IProvidesResultStore resultStore = ObjectMap.Instance.GetObjectFromID <IProvidesResultStore>(objectName);
         if (resultStore == null)
         {
             throw new ArgumentException("The provided object is not a results object.");
         }
         if (resultStore.GetResultStore().IsDate(resultName))
         {
             Date[,] dates = resultStore.GetResultStore().GetDates(resultName);
             return(ExcelUtilities.ConvertToObjects(dates));
         }
         else if (resultStore.GetResultStore().IsString(resultName))
         {
             return(ExcelUtilities.ConvertToObjects(resultStore.GetResultStore().GetStrings(resultName)));
         }
         else
         {
             return(ExcelUtilities.ConvertToObjects(resultStore.GetResultStore().Get(resultName)));
         }
     }
     catch (Exception e)
     {
         return(ExcelUtilities.Error2D(e));
     }
 }
예제 #2
0
 public static object[,] GetAvailableResults([ExcelArgument(Description = "The name of the results object as returned by call to another QuantSA function")] string objectName)
 {
     try
     {
         IProvidesResultStore resultStore = ObjectMap.Instance.GetObjectFromID <IProvidesResultStore>(objectName);
         string[]             temp        = resultStore.GetResultStore().GetNames();
         object[,] column = new object[temp.Length, 1];
         for (int i = 0; i < temp.Length; i++)
         {
             column[i, 0] = temp[i];
         }
         return(column);
     }
     catch (Exception e)
     {
         return(new object[, ] {
             { e.Message }
         });
     }
 }