Desktop productivity for business analysts and programmers

Display SAS log in a custom task

Reply
Contributor
Posts: 36

Display SAS log in a custom task

Hi everybody, hi Chris

I'm using in a Custom Task, "SAS.Tasks.Toolkit.Controls.SASTextEditorCtl" to display the log under Enterprise Guide 4.3. Everything works fine, the lines are colored according to the content: ERROR NOTE, WARNING, etc.. But the problem is, as you see in the following screen copies, that the first two characters of the beginning of each line are invisible.

SASLog.JPG

SASLog2.JPG

 

Did i forget some parameter or option ?

Thank's

Contributor
Posts: 36

Re: Display SAS log in a custom task

Any idea ?


Community Manager
Posts: 2,707

Re: Display SAS log in a custom task

Victor,

The first two characters of each log line is a cue to the editor for how to color the line.  When it displays the content, it then trims the first two characters off each line (as these are not meant to be seen) and then displays the remainder.  It looks like in this case, the log content might not have those two character indicators (although I'm not sure how it's being colored correctly...)

You can see my SAS Global Forum paper for details about how this works - the SAS log and coloring.  You don't say how you're creating the SAS log for this window, but perhaps it's not compatible with the assumptions that the text control uses for dealing with SAS log content.

Chris

Contributor
Posts: 36

Re: Display SAS log in a custom task

Hi

For avoidance of doubt, I put "eContentType.SASProgram" in ContenType property

The content is displayed correctly and without any problem

I also used a character string like "NOTE: Hello. This is a test" with EditorText Property. But the result still the same. Colored but 2 characters are missing

The log is a result from this function,

Public Shared Function GetLog() As String

        Dim arList() As String
        Dim arCC() As SAS.LanguageServiceCarriageControl
        Dim arLT() As SAS.LanguageServiceLineType
        Dim vOutLine As String
        Dim Log As String

        Log = Nothing
        WS.LanguageService.FlushLogLines(100000, arCC, arLT, arList)
        For Each vOutLine In arList
            Log = Log & vOutLine & vbCrLf
        Next vOutLine

        Return Log

    End Function

    Public Shared Function ExecuteSASLines(ByVal SASLines As String) As String

        SASModule.WS.LanguageService.Submit(SASLines)

        Return SASModule.GetLog

    End Function

    SASLogTEC.EditorText = ExecuteSASLines(SASCode)

Regards,

Community Manager
Posts: 2,707

Re: Display SAS log in a custom task

Instead of FlushLogLines, which returns the lines without the 2-character prefix, try FlushLog. 

FlushLogLines puts the line attribute information into another array.

Chris

Contributor
Posts: 36

Re: Display SAS log in a custom task

No, i have always the same problem

SASLog.bmp

This is the function GetLog, now

   Public Shared Function GetLog() As String
        Dim Log As String

        Log = WS.LanguageService.FlushLog(10000)
        Return Log
    End Function

Contributor
Posts: 36

Re: Display SAS log in a custom task

If i change the ContentType to  eContentType.SASProgram, i get this.

SASLog.bmp

You can see that what i send is correct

Community Manager
Posts: 2,707

Re: Display SAS log in a custom task

There is a simple example of this type of task, with C# source code, available here:

http://support.sas.com/documentation/onlinedoc/guide/customtasks/samples/SASProgramRunnerExample.zip

sample.png

This is part of the examples available at http://go.sas.com/customtasksapi.

Can you download that example and see if works correctly for you?

Chris

Contributor
Posts: 36

Re: Display SAS log in a custom task

Hello

Finally everything works perfectly. I have translated the C# code in VB.

here is the VB code for those interested

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExecuteBTN.Click
        AddHandler model.SubmitSASProgramComplete, AddressOf model_SubmitSASProgramComplete
        model.SubmitSASProgram(SASProgramTEC.EditorText)
    End Sub
    Public Delegate Sub MarshalledLogUpdater(ByVal Log As String)
    Sub MarshalledLogUpdate(ByVal Log As String)
        SASLogTec.EditorText = Log
    End Sub
    Sub model_SubmitSASProgramComplete(ByVal sender As Object, ByVal args As SAS.Tasks.Toolkit.SubmitCompleteEventArgs)
        Dim LogUpdate As MarshalledLogUpdater = New MarshalledLogUpdater(AddressOf MarshalledLogUpdate)

        RemoveHandler model.SubmitSASProgramComplete, AddressOf model_SubmitSASProgramComplete
        BeginInvoke(LogUpdate, args.Log)
    End Sub

Thank's

Ask a Question
Discussion stats
  • 8 replies
  • 414 views
  • 0 likes
  • 2 in conversation