This discussion is archived
6 Replies Latest reply: Apr 4, 2013 7:43 AM by HaiatTyson RSS

capturing warnings from FRM specs

dmccall Newbie
Currently Being Moderated
Is there a way for us to capture the warnings that are shown on screen? For example, the warnings on a FRM spec that appear after the yellow triangle with an exclamation point?
thanks,
David
  • 1. Re: capturing warnings from FRM specs
    KellyMayfield Expert
    Currently Being Moderated
    Can you explain the business problem you are trying to solve?
  • 2. Re: capturing warnings from FRM specs
    dmccall Newbie
    Currently Being Moderated
    We have a custom section where we post warning messages/validations for users to review before we allow workflow. We would like to capture the system warning messages in that same custom section as well to insure that the user is reviewing all messages, oracle generated and custom warnings.

    let me know if you need more info.
    thanks,
    David
  • 3. Re: capturing warnings from FRM specs
    Ron M Pro
    Currently Being Moderated
    For Specs, you should be able to get warnings via the SpecificationService.CurrentWarnings property and errors via the CurrentErrors property.
  • 4. Re: capturing warnings from FRM specs
    Dmitriy Kolasnikov Explorer
    Currently Being Moderated
    There is one gotcha when you use SpecificationService.CurrentWarnings property: the service will clear the warnings the moment you access CurrentWarnings property.
    Try to use SpecificationService.HasWarnings() method if you are going to check if the system has any warnings; otherwise, SpecificationService.CurrentWarnings.Count > 0 check will be evaluated correctly but the warnings will be gone the next time you access the property.
    If you want to keep the warnings after you consume them, just iterate over them and re-add back to the system using SpecificationService.AddWarning method.
  • 5. Re: capturing warnings from FRM specs
    Ivy Zhu Journeyer
    Currently Being Moderated
    "Some calculations were unable to run successfully. There may be incomplete values on the specification. Please review the warnings on the individual calculations for more details."
    When save or calculate a spec, the above warning message will be added to CurrentWarning (AddWarning(GetGSMSpecServiceTranslationVal("lblCalculationWarning")) in SpecificationService.Calculate() method) if there are errors of Calculated EAs or Calculated Custom Sections.

    Does this warning message persist (i.e. when i look at the warnings object will the warning message above be in it?) from the perspective of the Trade Spec?
    The SpecificationService will clear the warnings the moment you access CurrentWarnings property. Please see the Dmitriy's explanation about CurrentWaring :
    There is one gotcha when you use SpecificationService.CurrentWarnings property: the service will clear the warnings the moment you access CurrentWarnings property.
    Try to use SpecificationService.HasWarnings() method if you are going to check if the system has any warnings; otherwise, SpecificationService.CurrentWarnings.Count > 0 check will be evaluated correctly but the warnings will be gone the next time you access the property.
    If you want to keep the warnings after you consume them, just iterate over them and re-add back to the system using SpecificationService.AddWarning method.


    Let me know if you need more info.
    thanks,
    Ivy Zhu
  • 6. Re: capturing warnings from FRM specs
    HaiatTyson Newbie
    Currently Being Moderated
    so i tested two scenarios.

    scenario 1: we have a formulation spec which is linked to a trade spec. in the formulation spec i get the following warning to trigger by putting the spec in edit then saving and close.

    "Some calculations were unable to run successfully. There may be incomplete values on the specification. Please review the warnings on the individual calculations for more details."

    i then go the the trade spec, which the formulation spec is linked to, and workflow it. i have a guard wired up to execute in this transition, which in this example is complete spec to final review, with the following code:

    var specService = ctx.As<SpecLinearTransitionContext>().SpecificationService;
    if (specService.HasWarnings())
    {
    var warnings = specService.CurrentWarnings;
    }

    when i debug the code the specService has no warnings. so i thought maybe the warning doesn't persist outside the formulation spec. so i tried the simplified scenario below.

    scenario 2: i have a formulation spec which i trigger the warning message above in the similar manner. i then workflow the formulation spec. i have a guard wired up to execute in this transtion with the same code above. when i debug the code the specService has no warnings.

    do you see anything i might have coded wrong or am i missing something? scenario 2 was just a simple test to see if i could see/capture the warning message. scenario 1 is the problem we are trying to solve. thanks.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points