Normal Topic Button to grab field values and add to comments (Read 1089 times)
Robert Manshack
Member
*
Offline



Posts: 31
Joined: Jun 26th, 2014
Button to grab field values and add to comments
Mar 13th, 2015 at 6:50pm
Print Post Print Post  
What would the code look like for a button that grabs a few field values, concatenates them into a string, adds that string to a multi line text box, then clears the fields out?

this action is to follow the progression of a form being submitted.  If it's rejected I want them to just have a button to push and grab the dates from the first attempt, add it to the comments, then clear the dates for the next attempt.  They'd rather search comments field for the word "rejected" for a report than to create multiple records for the same person.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Button to grab field values and add to comments
Reply #1 - Mar 13th, 2015 at 7:42pm
Print Post Print Post  
Code
Select All
var vLine as String

	vLine = LE1 + " - " + LE2
	MyTextBox = MyTextBox + @Newline() + vLine
	Clear(LE1, LE2) 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Robert Manshack
Member
*
Offline



Posts: 31
Joined: Jun 26th, 2014
Re: Button to grab field values and add to comments
Reply #2 - Mar 13th, 2015 at 8:17pm
Print Post Print Post  
A "Clear" command huh?  Well isn't that handy....lol

I took a stab at it and got it done with this (I guess I answered my own question):

var commentstring as String

IF @ASKUSER("WARNING: This button is for a DPS rejection of the fingerpring card only",
           "Proceeding will clear out the date fields for the second attempt",
     "Do you want to proceed?")
{
     commentstring = @NL()+@MONTH(@DATE)+"/"+@DOM(@DATE)+"/"+@YEAR(@DATE)+" REJECTED BY DPS"
           +@NL()+"SENT TO DPO - "+@MONTH(SENT TO DPO)+"/"+@DOM(SENT TO DPO)+"/"+@YEAR(SENT TO DPO)
                 +"  RECVD FROM DPO - "+@MONTH(RECVD FROM DPO)+"/"+@DOM(RECVD FROM DPO)+"/"+@YEAR(RECVD FROM DPO)
           +@NL()+"SENT TO DPS - "+@MONTH(SENT TO DPS)+"/"+@DOM(SENT TO DPS)+"/"+@YEAR(SENT TO DPS)
                 +"  RECVD FROM DPS - "+@MONTH(RECVD FROM DPS)+"/"+@DOM(RECVD FROM DPS)+"/"+@YEAR(RECVD FROM DPS)
           +@NL()+"DUE FROM DPO - "+@MONTH(DUE FROM DPO)+"/"+@DOM(DUE FROM DPO)+"/"+@YEAR(DUE FROM DPO)
                 +"  DUE FROM DPS - "+@MONTH(DUE DATE)+"/"+@DOM(DUE DATE)+"/"+@YEAR(DUE DATE)
           +@NL()
           +COMMENTS
     COMMENTS = commentstring

     SENT TO DPO = ""
     SENT TO DPS = ""
     RECVD FROM DPO = ""
     RECVD FROM DPS = ""
     DUE FROM DPO = ""
     DUE DATE = ""

}
  
Back to top
 
IP Logged
 
Robert Manshack
Member
*
Offline



Posts: 31
Joined: Jun 26th, 2014
Re: Button to grab field values and add to comments
Reply #3 - Mar 13th, 2015 at 8:18pm
Print Post Print Post  
They end up with this in the comment box:

3/13/2015 REJECTED BY DPS
SENT TO DPO - 3/18/2015  RECVD FROM DPO - 3/1/2015
SENT TO DPS - 3/22/2015  RECVD FROM DPS - 3/7/2015
DUE FROM DPO - 4/2/2015  DUE FROM DPS - 3/29/2015
previous comments
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Button to grab field values and add to comments
Reply #4 - Mar 17th, 2015 at 2:08pm
Print Post Print Post  
FYI: You do want to use the Clear command instead of setting an element to "" for anything that is not Text. Clear is typesafe and knows how to properly clear dates, numbers, etc.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Robert Manshack
Member
*
Offline



Posts: 31
Joined: Jun 26th, 2014
Re: Button to grab field values and add to comments
Reply #5 - Mar 17th, 2015 at 4:51pm
Print Post Print Post  
Good to know.....Thanks!
  
Back to top
 
IP Logged