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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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