BookmarkSubscribeRSS Feed
Victor
Calcite | Level 5

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

8 REPLIES 8
Victor
Calcite | Level 5

Any idea ?


ChrisHemedinger
Community Manager

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

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Victor
Calcite | Level 5

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,

ChrisHemedinger
Community Manager

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

FlushLogLines puts the line attribute information into another array.

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Victor
Calcite | Level 5

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

Victor
Calcite | Level 5

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

SASLog.bmp

You can see that what i send is correct

ChrisHemedinger
Community Manager

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

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Victor
Calcite | Level 5

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2456 views
  • 0 likes
  • 2 in conversation