Re: WritePro expression undefined
David, eval is a project method that will execute a PROCESS 4D TAGS. I am pretty sure Erick provided an explanation to what that method does. Regards, Add On 12/23/18, 11:29 PM, "4D_Tech on behalf of David Ringsmuth via 4D_Tech" <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote: Tim! We have great support from 4D! (Erick) This is an effective 4D tech support work-around to the problem of “Undefined”. Here “WParea” is a 4D Write Pro object. After running this method on our converted 4D Write to 4D Write Pro documents, none of the embedded statements return “Undefined”. It wraps all embedded expressions in an ‘eval(“….”)’. I did not find “eval” as a 4D command, but it works! Off-Topic: Lastly, I must conceive a way to convert the embedded picts… //- C_OBJECT($range) C_LONGINT($start;$end;$i;$type) C_TEXT($text;$Newtext) WP SELECT(WParea;wk start text;wk end text) $range:=WP Get selection(WParea) $start:=OB Get($range;"start") $end:=OB Get($range;"end") ARRAY TEXT($methodArray;0) APPEND TO ARRAY($methodArray;"eval") SET ALLOWED METHODS($methodArray) For ($i;$start;$end) $type:=ST Get content type(*;"WParea";$i;$i) If ($type=2) // found expression $text:=ST Get expression($range;$i;$i) $text:=Replace string($text;"\"";"\\\"") $Newtext:="eval ("+"\""+$text+"\""+")" ST INSERT EXPRESSION(*;"WParea";$Newtext;$i;$i+1) End if End for //--- If you observe it, MERRY CHRISTMAS David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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) 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: WritePro expression undefined
Tim! We have great support from 4D! (Erick) This is an effective 4D tech support work-around to the problem of “Undefined”. Here “WParea” is a 4D Write Pro object. After running this method on our converted 4D Write to 4D Write Pro documents, none of the embedded statements return “Undefined”. It wraps all embedded expressions in an ‘eval(“….”)’. I did not find “eval” as a 4D command, but it works! Off-Topic: Lastly, I must conceive a way to convert the embedded picts… //- C_OBJECT($range) C_LONGINT($start;$end;$i;$type) C_TEXT($text;$Newtext) WP SELECT(WParea;wk start text;wk end text) $range:=WP Get selection(WParea) $start:=OB Get($range;"start") $end:=OB Get($range;"end") ARRAY TEXT($methodArray;0) APPEND TO ARRAY($methodArray;"eval") SET ALLOWED METHODS($methodArray) For ($i;$start;$end) $type:=ST Get content type(*;"WParea";$i;$i) If ($type=2) // found expression $text:=ST Get expression($range;$i;$i) $text:=Replace string($text;"\"";"\\\"") $Newtext:="eval ("+"\""+$text+"\""+")" ST INSERT EXPRESSION(*;"WParea";$Newtext;$i;$i+1) End if End for //--- If you observe it, MERRY CHRISTMAS David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
Tim! Thanks!!! I’m about to evaluate a work-around from the faithful tech support team… David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
On Dec 21, 2018, at 2:00 PM, David Ringsmuth wrote: > Add, > > 4D Write expressions did not require a value to be returned, so it was > acceptable to have embedded Query, Create Set, Intersection, Union, Use Set, > Selection to Array, etc…, commands in the 4D Write document. > > Converted to WritePro, the same expressions return “Undefined”. > > It is a change in behavior that requires editing 1000’s of documents. > > And WritePro does not provide an easy way to replace those expressions with a > method call that will not return “Undefined”. Hi David, I also include methods in 4D Write documents that do queries and other operations that do not return a value. I’ve never put raw 4D commands in a 4D Write expression, but many places are methods without $0 defined. I wonder if 4D Write Pro will do the same thing with methods that do not return a value? Have you tested this? And I agree with you that 4D Write Pro should not make this change in how it works compared to the 4D Write Plugin. It makes no sense. It should changed to work as it did before. A bug report/feature request needs to be submitted so that they can change this behavior immediately and you can then get a hotfix or nightly build that has this change. I’m guessing this was just an oversight in the 4D Write Pro implementation that the team never considered. It should be fixed. Tim * Tim Nevels Innovative Solutions 785-749-3444 timnev...@mac.com * ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
Add, 4D Write expressions did not require a value to be returned, so it was acceptable to have embedded Query, Create Set, Intersection, Union, Use Set, Selection to Array, etc…, commands in the 4D Write document. Converted to WritePro, the same expressions return “Undefined”. It is a change in behavior that requires editing 1000’s of documents. And WritePro does not provide an easy way to replace those expressions with a method call that will not return “Undefined”. David Ringsmuth From: Add Komoncharoensiri via 4D_Tech Sent: Friday, December 21, 2018 11:56 AM To: 4D iNug Technical Cc: Add Komoncharoensiri Subject: Re: WritePro expression undefined Hi David, If you are insert an expression into a 4D Write Pro document, the expression should return a value. For example: 100+90 Current date projectMethodThatReturnAValue For QUERY command, the execution will produce a selection of record in memory. It does not return a value that can be inserted to the document. Regards, Add On 12/20/18, 2:05 PM, "4D_Tech on behalf of David Ringsmuth via 4D_Tech" <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote: John, We can manually limit the entry of commands and methods, since we control the UI that inserts expressions. It would be easier is the command SET ALLOWED METHODS did this for us automatically. Thanks for your help John! David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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) 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) 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: WritePro expression undefined
Hi David, If you are insert an expression into a 4D Write Pro document, the expression should return a value. For example: 100+90 Current date projectMethodThatReturnAValue For QUERY command, the execution will produce a selection of record in memory. It does not return a value that can be inserted to the document. Regards, Add On 12/20/18, 2:05 PM, "4D_Tech on behalf of David Ringsmuth via 4D_Tech" <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote: John, We can manually limit the entry of commands and methods, since we control the UI that inserts expressions. It would be easier is the command SET ALLOWED METHODS did this for us automatically. Thanks for your help John! David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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) 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: WritePro expression undefined
John, We can manually limit the entry of commands and methods, since we control the UI that inserts expressions. It would be easier is the command SET ALLOWED METHODS did this for us automatically. Thanks for your help John! David Ringsmuth ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
There is no such command SET ALLOWED COMMANDS, only SET ALLOWED METHODS which only works on methods. If you allow users to enter "QUERY" then they can also enter DELETE SELECTION. The documentation says: > If you would like the user to be able to call 4D commands that are > unauthorized by default or plug-in commands, you must use specific methods > that handle these commands. > Note: The mechanism for filtering access to commands and methods in the > Formula editor can be disabled for all users or for the Designer and > Administrator via an option on the "Security" page of the Database Settings. > If the "Disabled for all" option is checked, the SET ALLOWED METHODS command > will have no effect. John DeSoi, Ph.D. > On Dec 20, 2018, at 2:15 PM, David Ringsmuth wrote: > > SET ALLOWED COMMANDS should also work for 4D commands, since if a user is > allowed to enter expressions, than those expressions should be restrictable. ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
John, We opened a case with 4D. WritePro optionally displays expressions, or their calculated values. We may have to parse the converted WritePro objects to replace queryies with a call formatted like: Query_ (->[Student];->[Student]AccountNo;"=";->[Account]AccountNo) …which does… QUERY($Table_p->;$Field_p->;$Operator_t;$Value_p->) It’s a bug. WritePro should not show “Undefined” as the result of a embedded query expression. SET ALLOWED COMMANDS should also work for 4D commands, since if a user is allowed to enter expressions, than those expressions should be restrictable. David Ringsmuth From: John DeSoi via 4D_Tech Sent: Thursday, December 20, 2018 11:43 AM To: 4D iNug Technical Cc: John DeSoi Subject: Re: WritePro expression undefined I see two options: 1. Submit a bug/feature request to 4D and hope they change it to return nothing instead of "Undefined". 2. Replace all of your QUERY commands with a method that returns an empty string. I don't use 4D Write Pro, but I think automating the replacement in 4D Write before conversion should not be too difficult. I also think it would be a win over the way you are doing it because having the project method shows the queries, tables, and fields in the design environment referencing. You lose that visibility by embedding queries directly in 4D Write documents. Maybe that does not work if you have end users writing their own queries for 4D Write. That seems dangerous to me. John DeSoi, Ph.D. > On Dec 20, 2018, at 11:01 AM, David Ringsmuth wrote: > > We have hundreds of converted documents with queries in them that worked > correctly in 4D Write. There they executed and did not display “Undefined” in > the 4D Write document. These should not have to be wrapped commands to work > without an “Undefined” appearing in the WritePro document. > > This in new and apparently wrong behavior in WritePro. > > If this is not an error in WritePro, and if it is the intended operation of > WritePro, then it is a warning to everyone converting from 4D Write documents. > ** 4D Internet Users Group (4D iNUG) 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) 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: WritePro expression undefined
I see two options: 1. Submit a bug/feature request to 4D and hope they change it to return nothing instead of "Undefined". 2. Replace all of your QUERY commands with a method that returns an empty string. I don't use 4D Write Pro, but I think automating the replacement in 4D Write before conversion should not be too difficult. I also think it would be a win over the way you are doing it because having the project method shows the queries, tables, and fields in the design environment referencing. You lose that visibility by embedding queries directly in 4D Write documents. Maybe that does not work if you have end users writing their own queries for 4D Write. That seems dangerous to me. John DeSoi, Ph.D. > On Dec 20, 2018, at 11:01 AM, David Ringsmuth wrote: > > We have hundreds of converted documents with queries in them that worked > correctly in 4D Write. There they executed and did not display “Undefined” in > the 4D Write document. These should not have to be wrapped commands to work > without an “Undefined” appearing in the WritePro document. > > This in new and apparently wrong behavior in WritePro. > > If this is not an error in WritePro, and if it is the intended operation of > WritePro, then it is a warning to everyone converting from 4D Write documents. > ** 4D Internet Users Group (4D iNUG) 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: WritePro expression undefined
John, WritePro documents may contain references to [Table]Field, which requires that the record be present during printing, which may require QUERY commands. The embedded QUERY commands work, execute properly in WritePro. But in place of the embedded expression is the value “Undefined”. We have hundreds of converted documents with queries in them that worked correctly in 4D Write. There they executed and did not display “Undefined” in the 4D Write document. These should not have to be wrapped commands to work without an “Undefined” appearing in the WritePro document. This in new and apparently wrong behavior in WritePro. If this is not an error in WritePro, and if it is the intended operation of WritePro, then it is a warning to everyone converting from 4D Write documents. David Ringsmuth From: John DeSoi via 4D_Tech Sent: Thursday, December 20, 2018 10:38 AM To: 4D iNug Technical Cc: John DeSoi Subject: Re: WritePro expression undefined SET ALLOWED METHODS specifies project methods allowed, not 4D commands. So unless you named a project method the same as the 4D command QUERY, you are using it wrong. And the 4D command QUERY does not return a result, so I'm not sure how you would use that in an expression. Of course, you can write a 4D project method that uses QUERY and returns a result in $0 as the result of the 4D Write expression. John DeSoi, Ph.D. > On Dec 20, 2018, at 9:30 AM, David Ringsmuth via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > WP PRINT(Rpt_ob;wk 4D Write Pro layout) > SET ALLOWED METHODS included “QUERY” > > 4D Query command expressions appear as “Undefined” in the printed document. > The command appears successful. > > Please help! ** 4D Internet Users Group (4D iNUG) 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) 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: WritePro expression undefined
SET ALLOWED METHODS specifies project methods allowed, not 4D commands. So unless you named a project method the same as the 4D command QUERY, you are using it wrong. And the 4D command QUERY does not return a result, so I'm not sure how you would use that in an expression. Of course, you can write a 4D project method that uses QUERY and returns a result in $0 as the result of the 4D Write expression. John DeSoi, Ph.D. > On Dec 20, 2018, at 9:30 AM, David Ringsmuth via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > WP PRINT(Rpt_ob;wk 4D Write Pro layout) > SET ALLOWED METHODS included “QUERY” > > 4D Query command expressions appear as “Undefined” in the printed document. > The command appears successful. > > Please help! ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
WritePro expression undefined
4D v17.2.0.0 227919 R2 32bit or 64bit Windows 10 Home 1803 WP PRINT(Rpt_ob;wk 4D Write Pro layout) SET ALLOWED METHODS included “QUERY” 4D Query command expressions appear as “Undefined” in the printed document. The command appears successful. Please help! Thanks! David Ringsmuth ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **