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.
Did i forget some parameter or option ?
Thank's
Any idea ?
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
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,
Instead of FlushLogLines, which returns the lines without the 2-character prefix, try FlushLog.
FlushLogLines puts the line attribute information into another array.
Chris
No, i have always the same problem
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
If i change the ContentType to eContentType.SASProgram, i get this.
You can see that what i send is correct
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
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
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.