Marco Blom · Jun 2, 2016 go to post

Hi Timothy,

Thanks for this, works great!

However it brings me to another issue:

My dataset contains more rows than pagesize * number of paging buttons(5)

the no. of paging buttons seems to be fixed. Do you know if there is a method to change the number of paging buttons?

Thanks

Marco Blom · Oct 4, 2016 go to post

I have tested the example with the following as result:

result/output:

What did I do wrong (I have downloaded the samplecode from Github, so no typing errors)

Marco Blom · Nov 25, 2016 go to post

Thanks Michael and Stephen for you're response:

I am using 2016.2.0 windows x86-64

I did try to 'simplify ' and exclude fields in the sql statement without results:

this is the sql statement:

Maybe accessing the data with objectscript instead of sql is an alternative to retrieve the data?

My goal is to examine what went wrong to prevent loosing lots of data in future.

Thanks,

Marco Blom · Mar 25, 2017 go to post

Thank you Eduard!

Now it works. This is the code:

My only comment is that the -not working- code a (100%) sample is from the documentation, which makes it sometimes confusing...

Thanks.

Marco Blom · Mar 25, 2017 go to post

This was the code snippet I have used:

I am now looking how the get a "No data returned" message into my Form

Marco Blom · May 13, 2017 go to post

I would like to return a "No Data message" but why does the write statement not work?,

while the documentation is full of examples with the statement in it?

Marco Blom · Jul 8, 2017 go to post

Hi Vitaliy,

Thanks for you're response and code sample!

However I still have the behavior.

Could I be the issue that I am using a datacontroller / datamodel?

I am interested in the solution for reason that I do use a lot of similar forms.

see code:

Could the issue be something with the dataBinding?

Sorry I do not know how to present the sample code as you do!

Marco Blom · Nov 16, 2017 go to post

Thanks, sorry I did not mention, I have looked into that file but it does not give me a clue how to solve:

*** Recovery started at Thu Nov 16 19:23:55 2017
     Current default directory: c:\intersystems\cache\mgr
     Log file directory: .\
     WIJ file spec: c:\intersystems\cache\mgr\CACHE.WIJ
Recovering local (c:\intersystems\cache\mgr\CACHE.WIJ) image journal file...
Starting WIJ recovery for 'c:\intersystems\cache\mgr\CACHE.WIJ'.
WIJ file not found.
Exiting with status 3 (Success)
11/16/17-19:24:05:505 (9024) 2 cache.ids file was created by node 139407LINOLP, and this machine is W1064PRO1511
11/16/17-19:24:11:537 ( 8496) 3 cctrl.dll (error during startup):(289) Opstarten cache mislukt: besturingsproces van cache is abnormaal beëindigd (afsluitcode = 0).

Marco Blom · Dec 15, 2017 go to post

Hi Eduard, hard to get it working!

my file:

my code:

Class TestCsv.Csv Extends %Persistent
{
Property name As %String;
Property year As %Integer;
Property amount As %Numeric;
Property date As %Date;
ClassMethod Import()
{
set rowtype = "name VARCHAR(50),year INTEGER,amount NUMERIC(9,2),date DATE"
    set filename = "c:\temp\data.csv"
    do ##class(%SQL.Util.Procedures).CSVTOCLASS(2, .rowtype, filename,,,,"TestCsv.Csv")
}

My result:

(I use Windows 10)

no result

My filetest:

I still cannot find the error.

Marco Blom · Mar 10, 2018 go to post

Hi Eric, last time I have resolved by just doing a new installation.

However last week (march 2018) I got the same issue on all 4 instances on my computer. No clue what have caused the issue.

According to the logfile I had to delete Cache.WIJ which I did. I also replaced cache.cpf with _last.good-.cpf and deleted Cache.ids as you have recommended.

After this I restarted the machine. No result however.

According to Windows services : the Webserver for Cache cannot be started.

I want to share this information. I do not have a licence for official support, but do want to continue development in Cache.

Thanks,

Marco Blom · Jun 10, 2018 go to post

I have recently (June 2018) bought the book,  unfortunately no download of samples available (which I particular was hoping for).

Marco Blom · Jun 11, 2018 go to post

Hi there,  tried the code sample above and got this:

Why?

Unfortunately the community & books are full with half code snippets rather than showing working full code samples>

Themelani, can you please share you're working code to the community? then the item is completed! Thanks!

Marco Blom · Jun 12, 2018 go to post

Hi Robert, you are right, but I forgot to mention I got the error after adding Eduard his recommendationsmiley.

This is the code:

ClassMethod ImportCSV()
{
  set adapter = ##class(%File).%New("C:\temp\in.csv")
  
  set status = adapter.%Open("R")
  
  if $$$ISERR(status)
  {
   do $System.Status.DisplayError(status)
  }
  
  set counter =1
  
  while 'adapter.AtEnd
  {
   set line=adapter.ReadLine()
   
   set rec= ##class(CSVRecord).%New()
   
   set rec.ID=$piece(line,";",1)
   set rec.FName=$piece(line,";",2)
   set rec.Secname=$piece(line,";",3)
   set rec.Gender=$piece(line,";",4)
   set rec.Age=$piece(line,";",5)
   
     write rec.ID,
 
             rec.FName,
             rec.Secname ,
             rec.Gender,
             rec.Age,!
        
         Set savestatus=rec.%Save()
              
      if $$$ISERR(savestatus)
    {
     do $System.Status.DisplayError(status)
    }
   
    }
   
    //if error found during processing,show it
    if $$$ISERR(status)
    {
     do $System.Status.DisplayError(status)
    }
}

I do notice this topic comes back in time in the Community, so people are interested -and struggling with it like myself, but if we look back the items leave quite unanswered.... as people do not share their final working code... and only tell that they have solved the question.

Thanks!

Marco Blom · Jun 12, 2018 go to post

HI Robert, I have got it working now, and yes, the harder you struggle the bigger the victory when you succeed. And it is the charm of InterSystemssmiley

Thanks Eduard, I will come back on you're recommendation for sure in short time, as I did not fully understood last time.

Marco Blom · Sep 15, 2018 go to post

Thank you Julius, it works perfect!

I choose : do rec.OrgTypeSetObjectId($piece(line, ",", 2))

Marco Blom · Jun 21, 2019 go to post

Hi Lamont,

I do use the following in one of my applications:

ClientMethod Webbutton() [ Language = javascript ]
{
var table this.getComponentById('relationTable');
        var index table.getProperty('selectedIndex');
        if (index 0) {
                alert('No row is selected in the table.');
                return;
        }
        var data table.getRowData(index);
        if (data == null) {
                alert('Table is not in snapshot mode or invalid request.');
        }
        else {
                   var person=data.Website
                   var tpref "http://"
                   
                   
                   
                   alert (person)
                   ///alert (tWeb)
                   var url "http://www.google.com/"
                   
                   var url "http://" person;
                    window.open(url);
                  /// window.open(person);
}
}

It opens a URL from  a record selected in a TablePane. I think it opens the default browser (in my case Firefox).

Maybe this example helps you. (yes, the name of the variable [person] looks odd.)

For myself it works great

Marco Blom · Aug 29, 2016 go to post

Hi, I am building an Email client in Cache, and succeeded to send out emails (smpt)

On downloading emails I have tested the pop3 sample from the InterSystems documentation:

ClassMethod YPOPsAsPOP3() As %Net.POP3
{
  //Sample from InterSystems
  Set server=##class(%Net.POP3).%New()
  
  //YPOPs uses the default port
  //but let's set it anyway
  Set server.port=110
  //just in case we plan to fetch any messages
  //that have attachments
  //Set server.StoreAttachToFile=1
  //Set server.StoreInlineToFile=1
  //Set server.AttachDir="c:\DOWNLOADS\"
  
  //local host acts as the server
  Set servername="mail.xxxxxxxx.nl"
  //YPOPs works with a Yahoo email account
  Set user="marco@xxxx.nl"
  Set pass="XXXXXXXX"
  
  Set status=server.Connect(servername,user,pass)
  
  If $$$ISERR(status)
  {
    Do $System.Status.DisplayError(status)
    Quit $$$ERROR()
    }
    
    Do ##class(ZenMail.MailFunctions).ShowMailbox(server)
    Do ##class(ZenMail.MailFunctions).FetchMailbox(server)
    Do ##class(ZenMail.MailFunctions).ShowMsgInfo(1)
    
  Quit server
}

I succeed to get information out of my mailbox however with the following error(s):

and at the end:

has anybody an idea how to solve this? for me this error is a bit a flurry....

I would like to invite people to work on a working example with complete working code base rather than open answers

which do not contribute to a completed working topic.

Thanks in advance!

Marco Blom · Oct 7, 2016 go to post

I have tested the code above with a txt file with 3868 lines:

the file looks like this:

this is my code:

The result is only 12 lines, While line length tells the length of a line is 9??? I do not understand this.

Any suggestions or help please, Thanks in advance!

Marco Blom · Feb 28, 2017 go to post

Hi Stephen and Timothy, Real nice feature, but how does it work when the datasource of the tablepane is a query instead of the table?

Adding the TotalMatrix (Transient) property to the query resulted in an Error:

Suggestions appreciated!

Marco Blom · Dec 14, 2017 go to post

Hi there,

I have the following sample code, but none of them works.

with the last class I did test my csv file and it worked.

Class ZenImport.Country Extends %Persistent
{
Property Code As %String;
Property Name As %String;
ClassMethod LoadFromFile()
{
 Set pFileName="C:\temp\Country.csv"
 Set pDelimiter= $C(9)
 //Set pDelimiter=";"
 Set rowType="Code VARCHAR(2),Name VARCHAR(9)"
 Do ##class(%SQL.Util.Procedures).CSVTOCLASS(2,.rowType, pFileName, pDelimiter)
}
ClassMethod LoadFromFile2()
{
 set rowtype = "Code VARCHAR(2),Name VARCHAR(9)"
 set filename = "c:\temp\Country.csv"
 do ##class(%SQL.Util.Procedures).CSVTOCLASS(2, .rowtype, filename,,,,"Country.csv")
}
ClassMethod ImportCountries(srcDir As %String = "C:\temp", srcFile As %String = "Country.csv")
{
    try {
        set status = ##class(ZenImport.Country).%DeleteExtent()
        if $$$ISOK(status) {write !, "Deleted LS.Country Data"}
        else {do $system.Status.DisplayError(status) return}
    catch ex {}
    set srcStream = ##class(%Stream.FileCharacter).%New()
    set srcPath = srcDir_"\"_srcFile
    set srcStream.Filename = srcPath
    set srcStream.TranslateTable = "UTF8"
    set selectMode = 0
    set rowType = "Code VARCHAR(2),Name VARCHAR(9)"
    set delimiter = ";"
    set quote = """"
    set headerCount = 0
    set classname = "ZenImport.Country"
    do ##class(%SQL.Util.Procedures).CSVTOCLASS(selectMode, rowType, srcStream, delimiter, quote, headerCount, classname)
    write !, "Imported " _ srcPath _ " to ZenImport.Country", !
    QUIT
}
ClassMethod ImportStream() [ ZenMethod ]
{
///Test csv File -THIS ONE WORKS!-
Set stream=##class(%Stream.FileCharacter).%New()
Set sc=stream.LinkToFile("c:\temp\Country.csv")
if $$$ISERR(sc) Quit 
While 'stream.AtEnd {
Set line=stream.Read()
}
write !, line
Quit $$$OK
}

Test reading csv:

 

Hopefully you have a suggestion how I can get it working!

Marco Blom · Apr 10, 2020 go to post

HI Bart, How are you?

I would like to perform some testing with Cache and Node.js.

I am using: Cache for Windows (x86-64) 2017.1.1 (Build 111U_SU) Tue May 23 2017 13:20:26 EDT

and I have

How can I get the right version of the Cache.node? I do not have access tot the WRC and I see a lot of requests on this Community who would like to get the right version.

Dank je wel,

en groeten