How to "Get" the State of 4D Write Pro Standard Actions?

2019-08-05 Thread Tom Benedict via 4D_Tech
I am struggling with the new 4D Write Pro paradigm. 

One thing our Write Classic app has is a method which collects all the 
“Document Properties” into an array which we can use to manage the whole range 
of property/attributes for any given document or document editor.

Given the fundamental changes between Write Classic and Write Pro, the process 
of mapping these properties has proven to be a daunting task. I’ve been digging 
my way through it, piece by piece, discovering bits here and there in various 
parts of the documentation, blogs, sample DBs etc. 

There are many more, but here’s a few in the “Margins” theme which I’m stuck 
on. Margins are totally different. Write Pro uses the HTML Box Model consisting 
of Margin, Border and Padding boxes around each Element (Content) box. (view in 
a monospaced font for the table to display properly):

+-+--+---+
| 4D Write Classic| 4D Write Pro |  
 |
|  WR Get doc property()  |  WP GET ATTRIBUTES() |  
 |
+-+--+---+
| wr text inside margin   | wk inside|  
 |
+-+--+---+
| wr text outside margin  | wk outside   |  
 |
+-+--+---+
| wr text left margin | wk page margin left  |  
 |
+-+--+---+
| wr text right margin| wk page margin right |  
 |
+-+--+---+
| wr text top margin  | wk margin top|  
 |
+-+--+---+
| wr text bottom margin   | wk margin bottom |  
 |
+-+--+---+
| wr header top margin| wk margin top| specify header in range 
parameter |
+-+--+---+
| wr header bottom margin | wk margin bottom | specify header in range 
parameter |
+-+--+---+
| wr footer top margin| wk margin top| specify footer in range 
parameter |
+-+--+---+
| wr footer bottom margin | wk margin bottom | specify footer in range 
parameter |
+-+--+---+
| wr paper width  | wk page width|  
 |
+-+--+---+
| wr paper height | wk page height   |  
 |
+-+--+---+
| wr dead left margin |  |  
 |
+-+--+---+
| wr dead top margin  |  |  
 |
+-+--+---+
| wr left margin  |  |  
 |
+-+--+---+
| wr right margin |  |  
 |
+-+--+---+
| wr printable width  |  |  
 |
+-+--+---+
| wr printable height |  |  
 |
+-+--+---+
| wr first indent |  |  
 |
+-+--+---+

Has anyone else already done this exercise and would like to help me fill in 
the blanks?

Thanks,

Tom Benedict
**
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
**

Php Execute fixed in 4D v17.2

2019-08-05 Thread David Ringsmuth via 4D_Tech
If you get PHP Execute error using 4D v17.0, while not connected to the 
internet, your solution may be to a very recent 4D v17.2.

That’s all it took to fix the PHP Execute error I was getting.

Hth.

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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Got it!

Thanks Randy and the rest of you. It would have taken me a lot longer.

The PostMan app really helped and yes the header MUST be included in order
for it to work.

Once I saw how a good request was formatted I was able to pinpoint my 4D
code that was not doing the job 100%.

All good now.

Cheers

Jim Labos - infobase



-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: FORMAT NUMBER

2019-08-05 Thread Chuck Miller via 4D_Tech
Read my previous note. You will need to convert the array to text array and 
fill as a formatted number using code I already supplied

Regards 
Chuck 

Sent from my iPhone

> On Aug 5, 2019, at 5:59 PM, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> if ###,## does not display a blank for 0 you may have to  convert back 
> and forth to/from text to get the formatting you want
> 
> Chip
> 
>> On Mon, 5 Aug 2019 23:24:26 +0200, stardata.info via 4D_Tech wrote:
>> Sorry i use 4D V16 on Windows.
>> 
>> I need to display a number in an array real displayed in a list box.
>> In column settings of the list box, if I do not insert anything in 
>> Display number format, the decimal numbers are correctly displayed, 
>> but I have 0 instead of blank.
> ---
> Gas is for washing parts
> Alcohol is for drinkin'
> Nitromethane is for racing 
> **
> 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: FORMAT NUMBER

2019-08-05 Thread Chip Scheide via 4D_Tech
if ###,## does not display a blank for 0 you may have to  convert back 
and forth to/from text to get the formatting you want

Chip

On Mon, 5 Aug 2019 23:24:26 +0200, stardata.info via 4D_Tech wrote:
> Sorry i use 4D V16 on Windows.
> 
> I need to display a number in an array real displayed in a list box.
> In column settings of the list box, if I do not insert anything in 
> Display number format, the decimal numbers are correctly displayed, 
> but I have 0 instead of blank.
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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: FORMAT NUMBER

2019-08-05 Thread stardata.info via 4D_Tech

Sorry i use 4D V16 on Windows.

I need to display a number in an array real displayed in a list box.
In column settings of the list box, if I do not insert anything in 
Display number format, the decimal numbers are correctly displayed, but 
I have 0 instead of blank.


Thanks

Ferdinando

Il 05/08/19 21:00, 4d_tech-requ...@lists.4d.com ha scritto:

Message: 3
Date: Mon, 5 Aug 2019 11:48:46 -0400
From: Chuck Miller
To: 4DTechList Tech<4d_tech@lists.4d.com>
Subject: Re: FORMAT NUMBER
Message-ID:
<95863d81-6b67-400e-98a0-96534e372...@informed-solutions.com>
Content-Type: text/plain;   charset=utf-8

First of all. what version of 4D

I would think you can not do all you want with a number. You could do it with a 
text variable
for example

in the in display detail form event

If $YourNumber_R (is a real)
$YourNumber_R:= 100.5
$YourText:=string($YourNumber_R;”###.0”)

$YourNumber_R:= 100.52
$YourText:=string($YourNumber_R;”###.00”)


$YourNumber_R:= 0
$YourText:=“”

hope this helps

If do not think you cab change the format of a field during the display of it 
on a list box

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   

**
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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Hi Randy,

I just tried PostMan! Fantastic tool! A million thanks for suggesting that.

However I am still getting the same 400 error. It's great to be able to see
the complete request sent to Twilio.

The formatting looks good. This is teh problem I was having on my own and
that is why I asked for help.

I'll put in a request for some support from Twilio to see what's going on.

Jim



-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Here are what the HTTP_REQUEST parameters look like.

$lHTTPStatus:=HTTP Request(HTTP POST Method;$tURI;$tRequest;tResponse)

$tURI="https://api.twilio.com/2010-04-01/Accounts/account SID goes
here/Messages.json"

$tRequest="FROM=%2B15551234537=%2B15551212=Test%20SMS"

tResponse= "{"code": 21602, "message": "Message body is required.",
"more_info": "https://www.twilio.com/docs/errors/21602;, "status": 400}"

So it looks like loging in goes well but the formatting of "$tRequest"
doesn't jive with Trilio.

Anyone see what it could be? I'm new to direct HTTP requests like this.

Thanks

Jim



-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: Sending Text Messages From 4D

2019-08-05 Thread Jeffrey Kain via 4D_Tech
Are you URLEncoding the body of the text message?

Also, We have the country code with every phone number including the sending 
phone number (1 for US).  Did you try that?

> On Aug 5, 2019, at 2:06 PM, Jeffrey Kain  wrote:
> 
> Here's what I wrote for our app ($tUserName would be unique to you, along 
> with $tPassword and $tFromNumber). The method HTTP_Request_Build is just 
> building a text variable like:
> 
>"From=155=156=This%20is%20the%20text"
> 
> String_FixURL is just a URL-encode method that Miyako posted awhile back 
> (included at the end of this message).   
> 
> Also note that we're hard-coding the country code at '1' for US numbers only.
> 
>  // Twilio_Send
>  //
>  // $1 - TEXT - SendTo phone number
>  // $2 - TEXT - Message to send
> 
> C_TEXT($1;$tSendToNumber)
> C_TEXT($2;$tMessage)
> $tSendToNumber:=$1
> $tMessage:=$2
> 
> C_TEXT($tURI;$tUserName;$tPassword;$tPlugin;$tInfo;$tFromNumber;$tRequest;$tResponse)
> C_LONGINT($lJson;$lHTTPStatus;$lTimeout;$lPort)
> 
>  // Stuff unique to your Twilio account
> $tUserName:="Your Twilio username"
> $tPassword:="Your Twilio password"
> $tFromNumber:="Your Twilio mobile account number"
> 
> $tURI:="https://api.twilio.com/2010-04-01/Accounts/"+\
>  $tUserName+"/Messages.json"
> $tFromNumber:="+1"+$tFromNumber
> $tSendToNumber:="+1"+$tSendToNumber
>   
> $tRequest:=""
> HTTP_Request_Build (->$tRequest;"From";String_FixURL ($tFromNumber);"*")
> HTTP_Request_Build (->$tRequest;"To";String_FixURL ($tSendToNumber);"*")
> HTTP_Request_Build (->$tRequest;"Body";String_FixURL ($tMessage))
>   
> ARRAY TEXT($atHeaderNames;0)
> ARRAY TEXT($atHeaderValues;0)
> APPEND TO ARRAY($atHeaderNames;"content-type")
> APPEND TO ARRAY($atHeaderValues;"application/x-www-form-urlencoded")
> HTTP AUTHENTICATE ($tUserName;$tPassword;HTTP basic)
> $lTimeout:=10
> $lHTTPStatus:=HTTP Request (HTTP POST 
> method;$tURI;$tRequest;tResponse;$lTimeout;$atHeaderNames;$atHeaderValues)
> 
> 
>  // String_FixURL
>  //
>  // Returns urlencoded string in $0 from the string passed in $1
> 
> C_TEXT($0)
> C_TEXT($1)
>   
> C_TEXT($escaped)
> C_LONGINT($i)
> C_BOOLEAN($shouldEscape)
> C_BLOB($data)
>   
> For ($i;1;Length($1))
>   
>  $char:=Substring($1;$i;1)
>  $code:=Character code($char)
>   
>  $shouldEscape:=False
>   
>  Case of 
>: ($code=45)
>: ($code=46)
>: ($code>47) & ($code<58)
>: ($code>63) & ($code<91)
>: ($code=95)
>: ($code>96) & ($code<123)
>: ($code=126)
>  Else 
>$shouldEscape:=True
>  End case 
>   
>  If ($shouldEscape)
>CONVERT FROM TEXT($char;"utf-8";$data)
>For ($j;0;BLOB size($data)-1)
>  $hex:=String($data{$j};"")
>  $escaped:=$escaped+"%"+Substring($hex;Length($hex)-1)
>End for 
>  Else 
>$escaped:=$escaped+$char
>  End if 
>   
> End for 
>   
> $0:=$escaped
> 
>> On Aug 5, 2019, at 1:00 PM, Jim Labos - infobase via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I tried and was unsuccessful probably because of syntax so I gave up and
>> moved on. I am trying Clickatell soon.
>> 
>> If you have a working example for Twilio I would much appreciate looking at
>> it.
> 

**
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: Sending Text Messages From 4D

2019-08-05 Thread Randy Jaynes via 4D_Tech
Jim,

Have you tried using the PostMan application 
(https://www.getpostman.com/postman ) to 
work out the proper form of sending these requests?

I found it helped a lot in trying to figure out how to build the request to a 
couple REST APIs a last year.

It lets you build up the command string and see what you’re sending and what 
you’re getting back. From there it’s then easy to translate into the 
appropriate commands and variables to build the HTTP Request call you need in 
4D.

It may or may not help in this case, but it did make it faster and easier to 
see things when I was working on this stuff.

HTH,
Randy

--
Randy Jaynes
Senior Programmer and Customer Support

http://printpoint.com • 845.687.3741 • PrintPoint, Inc • 57 Ludlow Lane • 
Palisades, NY 10964 
Please send all email contacts to supp...@printpoint.com



> On Aug 5, 2019, at 3:42 PM, Jim Labos - infobase via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Thanks Koen, but with the headers I get a 404. Not sure but I believe the
> headers are optional. My guess is that the "$tRequest" var is not formatted
> correctly.
> 
> I'm going to ask Twilio if they can help here.
> 
> Cheers
> 
> Jim Labos - infobase
> 
> 
> 
> -
> Jim Labos - infobase
> --
> Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> **
> 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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Thanks Koen, but with the headers I get a 404. Not sure but I believe the
headers are optional. My guess is that the "$tRequest" var is not formatted
correctly.

I'm going to ask Twilio if they can help here.

Cheers

Jim Labos - infobase



-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: Sending Text Messages From 4D

2019-08-05 Thread Tim Nevels via 4D_Tech
On Aug 5, 2019, at 2:00 PM, Jim Labos wrote:

> Hi Tim (or anyone else that could help),
> 
> I am looking for a quick and simple SMS solution and came upon your (Tim's) 
> message that you possibly had gotten some HTTP code snippets to send SMS via
> 4D using Twilio.
> 
> I tried and was unsuccessful probably because of syntax so I gave up and
> moved on. I am trying Clickatell soon.
> 
> If you have a working example for Twilio I would much appreciate looking at
> it.
> 
> Thanks in advance.

Hi Jim,

I got some code from Justin Leavens that David Adams had created using NTK long 
before we had 4D’s HTTP Request command. I modified and adapted it to use HTTP 
Request since my project did not use NTK. 

There are 2 utility methods. StripBadCharacters makes sure the message text has 
not “bad” characters. Twilio_ConvertDateToDTS converts the human readable date 
time to a normally formatted DTS. 

  // ===
  // PROJECT METHOD: Twilio_SendSMS

  // PARAMETERS: $0 = object with results
  // $1 = to phone number
  // $2 = message text

  // DESCRIPTION: Send an SMS via the Twilio service.

  // 
https://api.twilio.com/2010-04-01/Accounts/1ee6776/SMS/Messages.json

  // CREATED BY: David Adams (provided to me by Justin Leavens)
  // DATE: Unknown
  // LAST MODIFIED: 8/31/18 changed it from using NTK to 4D HTTP Request
  // made it conform to my programming style
  // 

C_OBJECT($0;$result_o)
C_TEXT($1;$toPhoneNumber_t)
C_TEXT($2;$message_t)
$toPhoneNumber_t:=$1
$message_t:=$2

  // declare local variables
C_TEXT($errorMessage_t;$fromPhoneNumber_t;$toPhoneNumber_t;$message_t;$toPhoneDialingCode_t)
C_TEXT($twilioAccountSID_t;$twilioAuthToken_t;$requestURL_t;$content_t;$fromPhoneNumber_t)
C_LONGINT($statusCode_l)
C_OBJECT($response_o)
ARRAY TEXT($headerName_at;0)
ARRAY TEXT($headerValue_at;0)

  // remove any bad characters from the message
StripBadCharacters (->$message_t)  // Control characters can mess up Twilio as 
it likes things XML safe. 

  // Encode & characters (all the other special URL characters seem to be OK 
with Twilio)
$message_t:=Replace string($message_t;"&";"%26")

  // use basic authentication
$fromPhoneNumber_t:=<>twilioPhoneNumber_t
$twilioAccountSID_t:=<>twilioAccountSID_t
$twilioAuthToken_t:=<>twilioAuthToken_t
HTTP AUTHENTICATE($twilioAccountSID_t;$twilioAuthToken_t;HTTP basic)

  // strip any phone number formatting
$toPhoneNumber_t:=Replace string($toPhoneNumber_t;"(";"")  // strip "("
$toPhoneNumber_t:=Replace string($toPhoneNumber_t;")";"")  // strip ")"
$toPhoneNumber_t:=Replace string($toPhoneNumber_t;"-";"")  // strip "-"
$toPhoneNumber_t:=Replace string($toPhoneNumber_t;" ";"")  // no spaces

  // build URL
$requestURL_t:="https://api.twilio.com/2010-04-01/Accounts/"+$twilioAccountSID_t+"/SMS/Messages.json;

  // build headers (content won't parse correctly on the Twilio side without 
this)
APPEND TO ARRAY($headerName_at;"Content-Type")
APPEND TO ARRAY($headerValue_at;"application/x-www-form-urlencoded")

  // build content
$content_t:="From="+$fromPhoneNumber_t+"&"
$content_t:=$content_t+"To="+$toPhoneNumber_t+"&"
$content_t:=$content_t+"Body="+$message_t

  // send the message
$statusCode_l:=HTTP Request(HTTP post 
method;$requestURL_t;$content_t;$response_o;$headerName_at;$headerValue_at)

  // seup response object
Case of 
   : ($statusCode_l=201)  // successful sent SMS
  OB SET($result_o;"error";False)
  OB SET($result_o;"sid";OB Get($response_o;"sid"))
// can't use "date_sent" because it could be queued
  OB SET($result_o;"sentDTS";Twilio_ConvertDateToDTS (OB 
Get($response_o;"date_created")))

   Else   // problem
  $errorMessage_t:="ERROR in sending SMS Message"+<>CR+<>CR+\
 "Status = "+String($statusCode_l)+<>CR+<>CR+\
 JSON Stringify($response_o;*)
  OB SET($result_o;"error";True)
  OB SET($result_o;"errorMessage";$errorMessage_t)
End case 

  // return any error message
$0:=$result_o


  // ===
  // PROJECT METHOD: StripBadCharacters

  // PARAMETERS: $1 = pointer to text
  // $2 = flag to allow carriage returns (optional)

  // DESCRIPTION: Checks a text variable or alpha field or text field
  // for any characters that are "invisible" an removes them. These
  // are generally low ASCII value characters like Char(0) and Char(1).

  // This should eliminate the problem of doing a copy/paste from an
  // email or from a Word document that later causes problems when 
  // trying to do an Outlook email.

  // Line Feed and Tab characters are stripped in all cases.

  // It strips Carriage Returns unless you want to allow them, like for
  // text fields.

  // CREATED BY: Tim Nevels, Innovative Solutions ©2018
  // DATE: 2/22/18
  // LAST MODIFIED: 
  // 

C_POINTER($1;$theText_p)
C_TEXT($2)
$theText_p:=$1
If (Count parameters>=2)
   

Re: Sending Text Messages From 4D

2019-08-05 Thread Koen Van Hooreweghe via 4D_Tech
Hi Jim,

You're not sending the headers. You must add the arrays in HTTP Request. That 
might lead into an 400 'bad request' error.

$lHTTPStatus:=HTTP Request(HTTP POST Method;$tURI;$tRequest;tResponse; 
atHeaderNames; atHeaderValues)

HTH
Koen

> Op 5 aug. 2019, om 21:17 heeft Jim Labos - infobase via 4D_Tech 
> <4d_tech@lists.4d.com> het volgende geschreven:
> 
> $lHTTPStatus:=HTTP Request(HTTP POST Method;$tURI;$tRequest;tResponse)



—
Koen Van Hooreweghe
—




**
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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Thanks for the code example, much appreciated. I keep getting a 400 HTTP
error however.

I am not using "HTTP_Request_Build" as I don't have it but I assume the "*"
is an option to omit or include some characters for formatting.

Here is what I am using from your code less proper username (assume it is
the Account SID), password (assume it is the Authorization token) and phone
numbers. Note I left out some parameters in the "HTTP Request" method as I
am using v13.6 on this version and there is no timeout parameter.

It may be that the "tRequest" var is not being formatted properly?

I'll be trying in v15 next to see if I get better results.


  // Twilio_Send
  //
  // $1 - TEXT - SendTo phone number
  // $2 - TEXT - Message to send

C_TEXT($1;$tSendToNumber)
C_TEXT($2;$tMessage)
$tSendToNumber:="5145551212"  //$1
$tMessage:="Test SMS"  //$2

C_TEXT($tURI;$tUserName;$tPassword;$tPlugin;$tInfo;$tFromNumber;$tRequest;$tResponse;tResponse)
C_LONGINT($lJson;$lHTTPStatus;$lTimeout;$lPort)

  // Stuff unique to your Twilio account
$tUserName:="Account SID"
$tPassword:="AUTH Token"  //"Your Twilio password"
$tFromNumber:="5552221212"  //"Your Twilio mobile account number"

$tURI:="https://api.twilio.com/2010-04-01/Accounts/"+$tUserName+"/Messages.json;
$tFromNumber:="+1"+$tFromNumber
$tSendToNumber:="+1"+$tSendToNumber

$tRequest:=""

$tRequest:="FROM="+$tFromNumber  //String_FixURL ($tFromNumber)
$tRequest:=$tRequest+"="+$tSendToNumber  //String_FixURL ($tSendToNumber)
$tRequest:=$tRequest+"="+String_FixURL ($tMessage)


ARRAY TEXT($atHeaderNames;0)
ARRAY TEXT($atHeaderValues;0)
APPEND TO ARRAY($atHeaderNames;"content-type")
APPEND TO ARRAY($atHeaderValues;"application/x-www-form-urlencoded")
HTTP AUTHENTICATE($tUserName;$tPassword;HTTP Basic)
$lTimeout:=10
$lHTTPStatus:=HTTP Request(HTTP POST Method;$tURI;$tRequest;tResponse)




-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: Sending Text Messages From 4D

2019-08-05 Thread Jeffrey Kain via 4D_Tech
Here's what I wrote for our app ($tUserName would be unique to you, along with 
$tPassword and $tFromNumber). The method HTTP_Request_Build is just building a 
text variable like:

"From=155=156=This%20is%20the%20text"

String_FixURL is just a URL-encode method that Miyako posted awhile back 
(included at the end of this message). 

Also note that we're hard-coding the country code at '1' for US numbers only.

  // Twilio_Send
  //
  // $1 - TEXT - SendTo phone number
  // $2 - TEXT - Message to send

C_TEXT($1;$tSendToNumber)
C_TEXT($2;$tMessage)
$tSendToNumber:=$1
$tMessage:=$2

C_TEXT($tURI;$tUserName;$tPassword;$tPlugin;$tInfo;$tFromNumber;$tRequest;$tResponse)
C_LONGINT($lJson;$lHTTPStatus;$lTimeout;$lPort)

  // Stuff unique to your Twilio account
$tUserName:="Your Twilio username"
$tPassword:="Your Twilio password"
$tFromNumber:="Your Twilio mobile account number"

$tURI:="https://api.twilio.com/2010-04-01/Accounts/"+\
  $tUserName+"/Messages.json"
$tFromNumber:="+1"+$tFromNumber
$tSendToNumber:="+1"+$tSendToNumber

$tRequest:=""
HTTP_Request_Build (->$tRequest;"From";String_FixURL ($tFromNumber);"*")
HTTP_Request_Build (->$tRequest;"To";String_FixURL ($tSendToNumber);"*")
HTTP_Request_Build (->$tRequest;"Body";String_FixURL ($tMessage))

ARRAY TEXT($atHeaderNames;0)
ARRAY TEXT($atHeaderValues;0)
APPEND TO ARRAY($atHeaderNames;"content-type")
APPEND TO ARRAY($atHeaderValues;"application/x-www-form-urlencoded")
HTTP AUTHENTICATE ($tUserName;$tPassword;HTTP basic)
$lTimeout:=10
$lHTTPStatus:=HTTP Request (HTTP POST 
method;$tURI;$tRequest;tResponse;$lTimeout;$atHeaderNames;$atHeaderValues)


  // String_FixURL
  //
  // Returns urlencoded string in $0 from the string passed in $1

C_TEXT($0)
C_TEXT($1)

C_TEXT($escaped)
C_LONGINT($i)
C_BOOLEAN($shouldEscape)
C_BLOB($data)

For ($i;1;Length($1))

  $char:=Substring($1;$i;1)
  $code:=Character code($char)

  $shouldEscape:=False

  Case of 
: ($code=45)
: ($code=46)
: ($code>47) & ($code<58)
: ($code>63) & ($code<91)
: ($code=95)
: ($code>96) & ($code<123)
: ($code=126)
  Else 
$shouldEscape:=True
  End case 

  If ($shouldEscape)
CONVERT FROM TEXT($char;"utf-8";$data)
For ($j;0;BLOB size($data)-1)
  $hex:=String($data{$j};"")
  $escaped:=$escaped+"%"+Substring($hex;Length($hex)-1)
End for 
  Else 
$escaped:=$escaped+$char
  End if 

End for 

$0:=$escaped

> On Aug 5, 2019, at 1:00 PM, Jim Labos - infobase via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> I tried and was unsuccessful probably because of syntax so I gave up and
> moved on. I am trying Clickatell soon.
> 
> If you have a working example for Twilio I would much appreciate looking at
> it.

**
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: FORMAT NUMBER

2019-08-05 Thread Chuck Miller via 4D_Tech
That is why I asked about version and what you show is truncated not rounded

Also I would suppose ###.## would take care of all

Didn’t think of that one


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. 

> On Aug 5, 2019, at 12:14 PM, Keith Culotta via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> 10.1237 as 10.123 <- rounding

**
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: Sending Text Messages From 4D

2019-08-05 Thread Jim Labos - infobase via 4D_Tech
Hi Tim (or anyone else that could help),

I am looking for a quick and simple SMS solution and came upon your (Tim's) 
message that you possibly had gotten some HTTP code snippets to send SMS via
4D using Twilio.

I tried and was unsuccessful probably because of syntax so I gave up and
moved on. I am trying Clickatell soon.

If you have a working example for Twilio I would much appreciate looking at
it.

Thanks in advance.

Cheers

Jim - infobase

_
Sent from http://4d.1045681.n5.nabble.com





-
Jim Labos - infobase
--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: FORMAT NUMBER

2019-08-05 Thread Keith Culotta via 4D_Tech
This ##0.###; ;  produces good results for the example of 0.5
There are some things to watch for in the display detail event
4D v17

0 as blank
1 as 1
.5 as 0.5
.007 as 0.007
.0007 as 0  <- not blank
10.12345 as 10.123
10.1237 as 10.123 <- rounding

Keith - CDI

> On Aug 5, 2019, at 9:58 AM, stardata.info via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi All,
> 
> I need to format one column in a list box.
> The column contains numeric values.
> The values can have tre decimal digits.
> I want a blank if number is zero.
> I need to display 0,5 value for examples and i use ##0,00;; as a format but 
> not work.
> 
> Does someone have a suggestion?
> 
> Thanks
> 
> Ferdinando

**
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: FORMAT NUMBER

2019-08-05 Thread Chuck Miller via 4D_Tech
First of all. what version of 4D

I would think you can not do all you want with a number. You could do it with a 
text variable
for example

in the in display detail form event

If $YourNumber_R (is a real)
$YourNumber_R:= 100.5
$YourText:=string($YourNumber_R;”###.0”)

$YourNumber_R:= 100.52
$YourText:=string($YourNumber_R;”###.00”)


$YourNumber_R:= 0
$YourText:=“”

hope this helps

If do not think you cab change the format of a field during the display of it 
on a list box

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 actionin 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. 

> On Aug 5, 2019, at 10:58 AM, stardata.info via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi All,
> 
> I need to format one column in a list box.
> The column contains numeric values.
> The values can have tre decimal digits.
> I want a blank if number is zero.
> I need to display 0,5 value for examples and i use ##0,00;; as a format but 
> not work.
> 
> Does someone have a suggestion?
> 
> Thanks
> 
> Ferdinando

**
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
**

FORMAT NUMBER

2019-08-05 Thread stardata.info via 4D_Tech

Hi All,

I need to format one column in a list box.
The column contains numeric values.
The values can have tre decimal digits.
I want a blank if number is zero.
I need to display 0,5 value for examples and i use ##0,00;; as a format 
but not work.


Does someone have a suggestion?

Thanks

Ferdinando


**
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: POS Systems

2019-08-05 Thread Douglas Cryer via 4D_Tech
Hi David,

I have done a few POS related projects in the past 20 years.  What is meant by 
POS can be quite wide.  When I refer to it I mean retail till systems.

I currently have a number of systems that use a 4D solution for till sales in 
fashion clothing boutiques.  Integrated with Card payment systems, receipt 
printers, CCTV time matching against receipts, real-time warehouse stock 
checking.  Nothing particularly ground breaking.  Our own till system is a 
small part of our retail work.  In the UK we have integrations with over 30 
retailers where we push up products and prices to their own till systems and 
receive back sales on a daily basis.

I did also look at doing a hospitality solution but I decided without a sponsor 
it would just turn into an academic exercise. 

What are you trying to do and in what marketplace?

Regards,  Dougie


telekinetix Limited- J. Douglas Cryer
Phone : 01234 761759  Mobile : 07973 675 218
2nd Floor Broadway House, 4-6 The Broadway, Bedford MK40 2TE
Email : jdcr...@telekinetix.com  Web : http://www.telekinetix.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
**