Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

end while error - xbasic array Multiple SMS twilio

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    The call was great, and our hang up time was perfect.
    Dinner arrived within 5 seconds of us hanging up.

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Had a great call with Gregg, together (mostly his help) we came up with working code: See if you can spot the part that makes it work over the previous code that didn't...

    Code:
    FUNCTION SendTw AS C (e as p)
    
    debug(1)
    '==CONNECTION AND VARS
    dim cn as SQL::Connection
    dim vHasError as c
    dim cf as extension::CurlFile
    dim flag_1 as l
    dim ce as extension::Curl	
    dim vSendNumber as c
    dim args as sql::arguments
    dim vUser as c
    dim SendTw as c
    dim vResult[0] as p
    
    cn.open("::Name::Connection1")
    args.Add("thedate",convert_type(e._CurrentRowDataNew.Date,"D"))
    args.Add("coid",e._CurrentRowDataNew.company_id)
    
     
    vSelect = "SELECT Employee_phone, Sending_Data FROM alphanwcopro.send_tasks WHERE Date = :thedate AND company_id = :coid"
    
    cn.topropertyarray(vSelect,args,vresult)
    vHasError = "N"
    
    
    
    vTwilioURLPre= "https://api.twilio.com/2010-04-01/Accounts/"
    vSID = "*******bf919b1724bc6d0"
    vTwilioURL=vTwilioURLPre+vSID+"/Messages.json"
    vToken = "******"
    vPassword=vSID+":"+vToken
    vFromNumber="+16303330311"
    vFrom="&From="+vFromNumber
    vSubject = "Job Assigments" 'irrelevant really to the SMS
    
    
    
    
    ce = extension::Curl.Init()
    ce.setOpt("URL",vTwilioURL)
    ce.setOpt("NOPROGRESS",1)
    ce.setOpt("USERPWD",vPassword)
    ce.setOpt("USERAGENT","curl/7.34.0")
    ce.setOpt("MAXREDIRS",50)
    ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem")
    ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot")
    ce.setOpt("CUSTOMREQUEST","POST")
    ce.setOpt("TCP_KEEPALIVE",1)
    
    
    
    for each banana in vresult
    	'debug(1)
    if eval_valid(banana.Employee_phone) then
    
    vSendNumber= banana.Employee_phone
    vMessage = banana.Sending_Data
    vTo="&To=+1"+remspecial(vSendNumber)
    vBody = "Body="+urlencode(vMessage)	
    vPostFields=vBody+vFrom+vTo
    ce.setOpt("POSTFIELDS",vPostFields)
    ce.setOpt("POSTFIELDSIZE_LARGE", len(vPostFields) )
    ce.SetOpt("FILE",cf)
    
    flag_1 = ce.Exec()
    if flag_1 then
    
        dim headers as c
    	dim contents as c
    	headers = cf.GetHeaders()
    	contents = cf.GetContent()
    end if
    
    
    end if
    
    next
    ce.close()
    cn.Close()
    
    end function

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    NWCOPRO Training & Help

    Please join my meeting from your computer, tablet or smartphone.

    https://www.gotomeet.me/nwcopro


    Working on this live - if your interested join the meeting. There might be some actual live data involved so please no screenshots or recording unless its for your own personal use, not that there is any sensitive data anyway...
    If you want to join or just hang out feel free. I am hoping to solve this issue and or maybe learn a few things while hanging out.

    You can also dial in using your phone.
    (For supported devices, tap a one-touch number below to join instantly.)

    United States: +1 (872) 240-3311
    - One-touch: tel:+18722403311,,984944085#

    Access Code: 984-944-085


    New to GoToMeeting? Get the app now and be ready when your first meeting starts: https://global.gotomeeting.com/install/984944085

    Leave a comment:


  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Glad to do it. It appears I have the office running smoothly today (several people now working from home).
    I know the frustration of APIs that don't work even though everything seems to suggest they should.

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    thanks that a very generous offer - its always fun to get together with another developer who speaks Alpha!

    Leave a comment:


  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    You have so much going on here, and you are understandably concerned about the privacy of the people in your table.
    With that said, based on what you're experiencing, there is obviously a problem somewhere.

    My advice is free, and should probably be tempered as such. More often than not, advice is worth what you pay for it.
    Sometimes however, you cannot put a price on free advice.

    I am more than willing to do a screen sharing session with you. I might see things in data that you miss (easy to do when
    it's data you deal with all the time. The code below is designed to force any obvious imperfections to be seen.
    There may be other errors based on different rules that I am unaware of.
    I'm still up and awake and willing to talk. Feel free to call me (608)345-2697 to pound through this if you want.

    Gregg
    P.S. This code is designed to be within a function, and you will have to provide the connection name

    [code]
    dim qResults[0] as p
    dim args as sql::arguments
    dim cn as sql::connection
    dim sqlCode as c
    dim itsOpen as l
    dim itWorked as l

    sqlCode = <<%txt%
    SELECT coalesce(Employee_phone,'000-000-0000') as Employee_phone, Sending_Data
    FROM alphanwcopro.send_tasks
    WHERE Date = :thedate AND company_id = :coid
    %txt%

    if .not. itsOpen then
    itsOpen = cn.open("::name::<connection"
    end if
    if .not. itsOpen then
    exit function
    end if
    'Be sure your arguments are set before processing the next line
    itWorked = cn.ToPropertyArray(sqlCode, args, qResults)
    debug(1)

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Yep looked there - no errors on their end - only the successful sends. From what I can tell the code is not executing from the resultset like how I think it should in my head. It seems to me the right way to do this would be to first get a count of the result then loop through them. the nextrow method doesn't seem to be working like I think it should.
    Now that said - I have no clue how to setup a for loop for the result set...for instance in the debugger as it loops through the rows I would think the vSendNumber variable would change as it loops through but I never see the value.
    It just seems to me if I can send once I can send for each record in the result set - it really blows when things don't work as expected...

    Leave a comment:


  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    I'm thinking you should ask twillio what's causing the error.
    The debugger should show what values you pulled from your system at the time of failure,
    you still need to review the error message from twillio.

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    maybe I need to do the send an entirely different way...

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Relentless testing getting nowhere...not all sends happen and I cannot figure out why. In all cases, the results all go through the cycle of the next rows as I walk through the debugger.
    6 expected sends to 3 different recipients = first recipient gets both second recipient gets 1 third recipient gets NONE
    3 expected sends to 3 different numbers first recipient gets nothing, 2nd and 3rd both get the send.
    2 expected sends to 2 different numbers first recipient gets nothing, second receives it.
    3 sends to a single recipient first one fails - 2nd and 3rd get sent.

    Just doesn't seem to be a clear WHY here other than pretty often the first record doesn't get sent.

    Watching flag_1 is see no issue there

    Leave a comment:


  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Hi Charles,
    Your xbasic seems to be fine, but the ce.exec() command is occasionally throwing an error.
    Put the code shown below into your function where indicated by the pic, and you should be able
    to see the data that's causing the problem, and hopefully get the info from twillio as to what ce.exec()
    doesn't like about what you're sending it.

    Code:
    if .not. flag_1 then
    debug(1)
    end if
    2020-03-26_11-37-33.png

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Well, further testing is weird. I notice that it sends the 2nd and 3rd one but NOT the first. Would the first row in the result set be "0" and not send?
    Oddly if I have only two records - both get sent provided they are to two different phone numbers, and again I do not think it is in the data sent as I can reverse the order and still get 2 & 3 but not the first one in the result set.
    If I have 2 items only the second one goes (for the same phone) So it is like if there are 5 records being sent via sms to the same phonenumber in the result set I get the 4 sent with what I would call row "0" the one not being sent.
    If I have 2 records with 2 phone numbers both go through

    Leave a comment:


  • madtowng
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Hey Charles,
    I'd be willing to bet it has something to do with that error it was throwing.
    You check for errors, but when you receive one, your code does nothing with the information.
    At the very least, I would have it append the error data to an error log so that you have a place
    to see what went wrong.

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    Getting back to my "working" code to send multiple sms - I am finding that I am only getting a max number of sends at 2 and I cannot see why. Anyone have any thoughts? It isn't the data because when I put them in a different order the first two go through but not the 3rd in the result set. So it can't be the "data".

    Leave a comment:


  • CharlesParker
    replied
    Re: end while error - xbasic array Multiple SMS twilio

    attached is a screenshot of the costs for feb. I have 3 numbers and as you can see I use a variety of paid addons in addition to the service. The "Studio charges" are for recording all of my incoming business calls which as I said then get inserted directly (as an mp3) into my application along with caller ID lookups when available, and as I said I email and sms through here too. I don't want to say it's heavy usage but for what it does I think it's a mild expense.

    twilio-cost.JPG

    I designed a flow for my phone calls in "studio" which allows for simple recordings sent to an endpoint as json (webhook basically)

    lots of fun!

    twilio-studio.JPG
    twilio-studio-record.JPG


    Ooops, I email through sparkpost! forgot!

    Leave a comment:

Working...
X