Re: v13+ - method comments (the Explorer Pane)

2018-05-07 Thread Wayne Stewart via 4D_Tech
Chip,

I wrote some code to do that for Foundation it relies on some discipline in
creating your header comments of course.


// 
// Project Method:  --> ReturnType
// Description
// Access: Shared
// Parameters:
//   $1 : Type : Description
//   $x : Type : Description (optional)

// Returns:
//   $0 : Type : Description

// Created by Wayne Stewart ()
// wa...@4dsupport.guru
// 



   // 
   // Project Method: Fnd_Shell_WriteComments {(Method Name; Do not use)}

   // This method will create documentation comments
   //   it is based on the assumption that you format your
   //method header comments in the same manner as Foundation
   //  The second paramater is just used to trigger the method
   //   starting in a new process, you should not pass anything in this
parameter

   // Access: Shared

   // Parameters:
   //   $1 : Text : Either pass
   //   (a) "" - All methods (or don't pass any parameters)
   //   (b) "Prefix" - Only methods which match a prefix (Eg. Fnd_Art)
   //   (c) "Specific method name" - write comments for that method
   //   $2 : Longint : Do not use this

   // Created by Wayne Stewart
   // 

C_TEXT($1)
C_LONGINT($2)

C_LONGINT($CurrentMethod_i;$NumberOfMethods_i;$Position_i;$ProcessID_i;$StackSize_i)
C_TEXT($FirstChars_t;$MethodCode_t;$MethodName_t;$ThreadSafe_t;$ThreadSafeSection_t)
C_OBJECT($Attributes_o)

ARRAY TEXT($MethodCode_at;0)
ARRAY TEXT($MethodNames_at;0)

If (False)
   C_TEXT(Fnd_Shell_WriteComments ;$1)
   C_LONGINT(Fnd_Shell_WriteComments ;$2)
End if


$StackSize_i:=0

If (Count parameters=2)

   METHOD GET PATHS(Path project method;$MethodNames_at)

   $MethodName_t:=$1

   If (Length($MethodName_t)>0)  //  A method name or prefix has been
specified

 $NumberOfMethods_i:=Count in array($MethodNames_at;$MethodName_t)

 If ($NumberOfMethods_i=1)  // exactly one match (use this specific
method)
   APPEND TO ARRAY($MethodNames_at;$MethodName_t)
 Else

   $NumberOfMethods_i:=Size of array($MethodNames_at)
   For ($CurrentMethod_i;$NumberOfMethods_i;1;-1)  // Go Backwards
 If ($MethodNames_at{$CurrentMethod_i}=($MethodName_t+"@"))
 Else
   DELETE FROM ARRAY($MethodNames_at;$CurrentMethod_i)
 End if

   End for

 End if

   End if

   $NumberOfMethods_i:=Size of array($MethodNames_at)

   METHOD GET CODE($MethodNames_at;$MethodCode_at)

   ARRAY TEXT($MethodComments_at;$NumberOfMethods_i)

   For ($CurrentMethod_i;1;$NumberOfMethods_i)
 $MethodCode_t:=$MethodCode_at{$CurrentMethod_i}

 $Position_i:=Position("comment added and reserved by
4D.\r";$MethodCode_t)

 $MethodCode_t:=Substring($MethodCode_t;$Position_i+Length("comment
added and reserved by 4D.\r"))

   //  Threadsafe?
 METHOD GET ATTRIBUTES($MethodNames_at{$CurrentMethod_i};$Attributes_o)
 $ThreadSafe_t:=OB Get($Attributes_o;"preemptive")

 Case of
   : ($ThreadSafe_t="capable")
 $ThreadSafeSection_t:="\rPreemptive\r"

   : ($ThreadSafe_t="incapable")
 $ThreadSafeSection_t:="\rCooperative\r"

   : ($ThreadSafe_t="indifferent")
 $ThreadSafeSection_t:="\rPreemptive capable\r"

 End case

 $MethodCode_t:=Replace string($MethodCode_t;"\r  // Access:
Shared\r";"\r  // Access: Shared\r"+$ThreadSafeSection_t)
 $MethodCode_t:=Replace string($MethodCode_t;"\r  // Access:
Private\r";"\r  // Access: Shared\r"+$ThreadSafeSection_t)

   //  End Threadsafe section

 $MethodCode_t:=Replace string($MethodCode_t;"  //
\r";"")
 $MethodCode_t:=Replace string($MethodCode_t;"//
\r";"")

 $MethodCode_t:=Replace string($MethodCode_t;"  // Project Method: ";"")
 $MethodCode_t:=Replace string($MethodCode_t;"// Project Method: ";"")

 $MethodCode_t:=Replace string($MethodCode_t;"  // ";"")
 $MethodCode_t:=Replace string($MethodCode_t;"// ";"")

 $Position_i:=Position("Created by";$MethodCode_t)

 $MethodCode_t:=Substring($MethodCode_t;1;($Position_i-3))

 $FirstChars_t:=Substring($MethodCode_t;1;2)
 While ($FirstChars_t="\r\r")
   $MethodCode_t:=Substring($MethodCode_t;2)
   $FirstChars_t:=Substring($MethodCode_t;1;2)
 End while

 $MethodComments_at{$CurrentMethod_i}:=$MethodCode_t

   End for

   METHOD SET COMMENTS($MethodNames_at;$MethodComments_at)

Else

   If (Count parameters=1)
 $MethodName_t:=$1
   Else
 $MethodName_t:=""
   End if

 // This version allows for any number of processes
 // $ProcessID_i:=New Process(Current method name;$StackSize_i;Current
method name;0)

 // On the other hand, this version allows for one unique process
   $ProcessID_i:=New process(Current method 

Re: v13+ - method comments (the Explorer Pane)

2018-05-07 Thread Dani Beaubien via 4D_Tech
Hi Chip,

You can use "METHOD SET COMMENTS” to set the method comments using code.

I actually use that call in my Code Analysis component. I have a feature that 
will look at each method, grab the comment lines at the top of the method until 
it hits a line that is not a comment, and then put those comments into the 
method comments using "METHOD SET COMMENTS”. Really useful for ensuring all the 
shared methods in a component have a comment can then be seen as a tip in a 
host database.

The Code Analysis component can be grabbed from here. Source code is there as 
well.
http://openroaddevelopment.com/downloads.html

Dani


> On May 7, 2018, at 3:04 PM, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I have not looked into this much...
> Is there a way in code to access the method comments (form the Explorer 
> Pane)?
> 
> I would like to be able to, as a start, copy the actual method header 
> comments into this area.
> 
> any info appreciated.
> 
> Thanks
> Chip
> 
> ---
> Gas is for washing parts
> Alcohol is for drinkin'
> Nitromethane is for racing 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

v13+ - method comments (the Explorer Pane)

2018-05-07 Thread Chip Scheide via 4D_Tech
I have not looked into this much...
Is there a way in code to access the method comments (form the Explorer 
Pane)?

I would like to be able to, as a start, copy the actual method header 
comments into this area.

any info appreciated.

Thanks
Chip

---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SQL Date Math

2018-05-07 Thread Richard Wright via 4D_Tech
So it would seem that while there are numerous functions to extract parts of a 
timestamp into it’s component parts, there is no function to create a date from 
a piece of text, no date operators nor any date functions by which you can add 
or subtract days or other component parts of a time stamp. In Oracle, for 
example, you can do the following to create a date:

To_Date(‘2018-05-07’,’-MM-DD’)

or to subtract days:

SYSDATE -3  (you can also use fractions of days)

or to add months:

ADD_MONTHS(SYSDATE,2)
  
But 4D SQL has nothing like these. This seems like a big oversight.




> Date: Sat, 5 May 2018 03:28:29 +
> From: Keisuke Miyako 
> the error message seems to be in line with what is explain in the 
> documentation:
> 
>> Automatic data type conversion is implemented between numeric types.
>> A string that represents a number is not converted to a corresponding 
>> number. There are special CAST functions that will convert values from one 
>> type to another.
> 
> http://doc.4d.com/4Dv16R6/4D/16-R6/4D-SQL-engine-implementation.300-3628406.en.html
> 
> in other words, you can't expect 4D to implicitly convert numeric 2 to 
> TIMESTAMP.
> 
> besides, with an expression such as
> Select someDate - 2
> it is unclear whether you want to subtract 2 years, months, days, hours, 
> minutes, second or milliseconds.
> 
> in addition to that, there is no way to express 2 days as TIMESTAMP.
> this is mentioned in the same URL, that 4D SQL does not support date 
> constants where the month or day is 0.
> in other words, you can't use { d '-00-02' } to specify 2 days.
> and in case you are wondering, you can't use {t '48:00:00'} either,
> because a time constant that exceeds 24 hours throws a parser error.
> 
> even if you find a way to specify 2 days in a way that the parser can 
> understand,
> there is the fundamental problem that arithmetic expressions between VK_TIME 
> (TIMESTAMP) values are type unsafe in 4D SQL.
> 
> so I think the best option is to use {FN () } with an "Add to date" wrapper
> 
> http://doc.4d.com/4Dv16R6/4D/16-R6/4d-function-call.300-3628422.en.html

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

FN call issues

2018-05-07 Thread Chuck Miller via 4D_Tech
Hi all, 

Environment 4D 15.6 windows server running 32  bit

mac 4D running 32 bit version of 4D

I log into server using sql and run code that looks like


text_txt:=select {fn MethodName() as text from [tablename] into :global 
variable;”

sql login

begin sql

execute immediate : text_txt;
end sql

The function call spawns a process and waits for data to be filled. The problem 
is that the process is launched many times even with one call

When I call from connected client and not as  function call it works as 
expected. Any ideas

If desired I can put exact code in drop box.

Thanks and regards

Chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Options To Put Data Into Existing Excel Spreadsheets?

2018-05-07 Thread Nigel Greenlee via 4D_Tech
Allan

I think I have the code you refer to. if it is the component that uses vbs 
scripts(such as application_arrange_windows.vbs)..this might have been 
something other than Miyakos’ code.. contact me off list and i can put a copy 
of this on a drop box for you.

C_TEXT($1)
C_TEXT($2)
C_TEXT($3)
C_TEXT($4)

SCPT_XL_SetParameter ("XCEL_WORKBOOK_NAME";$1)
SCPT_XL_SetParameter ("XCEL_SHEET_NAME";$2)
SCPT_XL_SetParameter ("XCEL_RANGE";$3)
SCPT_XL_SetParameter ("XCEL_VALUE";$4)

SCPT_XL ("range_set_value”)

Nigel





> On 7 May 2018, at 09:44, Allan Udy via 4D_Tech <4d_tech@lists.4d.com> wrote:
>  application_arrange_windows
> Hi All,
> 
> I'm up the proverbial creek without a paddle...
> 
> Years ago (v11) we started using the 'Excel Library' component put together 
> (I think) by Keisuke.  For the life of me I can no longer find a source 
> version of this (if there ever was one), and it appears that any online link 
> to the component no longer exists.
> 
> At one point we did get the component upgraded to work in a v14 database.  
> Seems (under MacOS at least) that it's still working under v16, but it's 
> plainly only 32-bit.  Due to a couple of other reasons we now need to look at 
> taking this single-user app to 64-bit, and of course it won't work.  :-(
> 
> I have found Keisuke's 4d-plugin-xls  
> (https://github.com/miyako/4d-plugin-xls), but this does not appear to 
> contain options to find and set cell ranges as the earlier component did, nor 
> is there any sensible documentation, so it's not really useable.
> 
> I'm aware of Pluggers XL Plugin, but at 600 Euro it's going to be hard sell 
> for our client when only basic use is made of Excel  (Open a spreadsheet, 
> find a couple of named cells, put data in those cells, save the spreadsheet).
> 
> Are there any other options out their to interface a 4D app with an Excel 
> spreadsheet?
> 
> Cheers,
> Allan Udy
> 
> Golden Micro Solutions Ltd, Blenheim, New Zealand
> http://www.golden.co.nz
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Options To Put Data Into Existing Excel Spreadsheets?

2018-05-07 Thread James Wright via 4D_Tech
Alan,

Could you not look at a PHP/Command line solution and script it with LEP?

https://phpspreadsheet.readthedocs.io/en/develop/

James.

On 7 May 2018 at 09:44, Allan Udy via 4D_Tech <4d_tech@lists.4d.com> wrote:

> Hi All,
>
> I'm up the proverbial creek without a paddle...
>
> Years ago (v11) we started using the 'Excel Library' component put
> together (I think) by Keisuke.  For the life of me I can no longer find a
> source version of this (if there ever was one), and it appears that any
> online link to the component no longer exists.
>
> At one point we did get the component upgraded to work in a v14 database.
> Seems (under MacOS at least) that it's still working under v16, but it's
> plainly only 32-bit.  Due to a couple of other reasons we now need to look
> at taking this single-user app to 64-bit, and of course it won't work.  :-(
>
> I have found Keisuke's 4d-plugin-xls  (https://github.com/miyako/4d-
> plugin-xls), but this does not appear to contain options to find and set
> cell ranges as the earlier component did, nor is there any sensible
> documentation, so it's not really useable.
>
> I'm aware of Pluggers XL Plugin, but at 600 Euro it's going to be hard
> sell for our client when only basic use is made of Excel  (Open a
> spreadsheet, find a couple of named cells, put data in those cells, save
> the spreadsheet).
>
> Are there any other options out their to interface a 4D app with an Excel
> spreadsheet?
>
> Cheers,
> Allan Udy
>
> Golden Micro Solutions Ltd, Blenheim, New Zealand
> http://www.golden.co.nz
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **




-- 
[image: logo]
*James Wright* C.T.O.*, Drag and Drop*
Tel: 08000 43 22 12 | Suite 6/7 Chichester House, 45 Chichester Road,
Southend-on-Sea, Essex SS1 2JU
supp...@draganddrop.co.uk | www.ezadspro.co.uk | www.draganddrop.co.uk
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Options To Put Data Into Existing Excel Spreadsheets?

2018-05-07 Thread Allan Udy via 4D_Tech

Hi All,

I'm up the proverbial creek without a paddle...

Years ago (v11) we started using the 'Excel Library' component put 
together (I think) by Keisuke.  For the life of me I can no longer find 
a source version of this (if there ever was one), and it appears that 
any online link to the component no longer exists.


At one point we did get the component upgraded to work in a v14 
database.  Seems (under MacOS at least) that it's still working under 
v16, but it's plainly only 32-bit.  Due to a couple of other reasons we 
now need to look at taking this single-user app to 64-bit, and of course 
it won't work.  :-(


I have found Keisuke's 4d-plugin-xls  
(https://github.com/miyako/4d-plugin-xls), but this does not appear to 
contain options to find and set cell ranges as the earlier component 
did, nor is there any sensible documentation, so it's not really useable.


I'm aware of Pluggers XL Plugin, but at 600 Euro it's going to be hard 
sell for our client when only basic use is made of Excel  (Open a 
spreadsheet, find a couple of named cells, put data in those cells, save 
the spreadsheet).


Are there any other options out their to interface a 4D app with an 
Excel spreadsheet?


Cheers,
Allan Udy

Golden Micro Solutions Ltd, Blenheim, New Zealand
http://www.golden.co.nz

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**