CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Adding letter to end of number

Print topic Send  topic

Author Message
deagon

Posts: 31
Posted: 10/26/2007, 2:51 PM

I'm using If then statements to determine the number of the Job for a sales organization. My logic is

If Jobstorage20.Submit1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .1
Elseif Jobstorage20.inspection1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .i
Elseif Jobstorage20.repair1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .r
Else jobstorage20.JobNumAdd1.Visible = false

End If

Of cource you can't add a letter to a number!! But I have inspections and repair that I need to put a letter .r or .i on the end. The numbering works fine. What kind of logic do I use to put a letter on the end of a number when a checkbox for repair or inspection is selected? I can put the letter on the end manually but thats not going to fly with our sales staff.
View profile  Send private message
wkempees


Posts: 1679
Posted: 10/27/2007, 7:59 AM

Cast your variable to a string, then do the concat on that string
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
GeorgeS

Posts: 206
Posted: 10/27/2007, 6:14 PM

Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & ".1"
_________________
GeorgeS
View profile  Send private message
deagon

Posts: 31
Posted: 10/29/2007, 8:38 AM

Thanks GeorgeS and wkempees, your & ".1" worked great. It puts the letter or number
on the end when submit is clicked. Nice. How do I stop the logic from adding the number or letter evertime I click submit. Is there a way to see if the varible is added and doesn't add it again? Have not found a way to look at the number and determine if there is something after the period.I can just see our Sales staff clicking submit over and over and getting 4000.1.1.1 and so on.
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 10/29/2007, 9:17 AM

If Right(Jobstorage20.JobNumAdd1.Value,2) <> ".1" AND Right(Jobstorage20.JobNumAdd1.Value,2) <> ".i" AND Right(Jobstorage20.JobNumAdd1.Value,2) <> ".r" then  
  
	If Jobstorage20.Submit1.Value = True Then  
		Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & .1  
	Elseif Jobstorage20.inspection1.Value = True Then  
		Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & .i  
	Elseif Jobstorage20.repair1.Value = True Then  
		Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & .r  
	Else jobstorage20.JobNumAdd1.Visible = false  
  
	End If  
  
End If

FYI, this is all basic ASP stuff, not CCS. You should brush up over here, http://www.w3schools.com/vbscript/default.asp
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
wkempees
Posted: 10/29/2007, 9:34 AM

  
If  InStr(Jobstorage20.JobNumAdd1.Value,".",1) > 0  
 then  
  
 If Jobstorage20.Submit1.Value = True Then  
 Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .1  
 Elseif Jobstorage20.inspection1.Value = True Then  
 Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .i  
 Elseif Jobstorage20.repair1.Value = True Then  
 Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + .r  
 Else jobstorage20.JobNumAdd1.Visible = false  
  
 End If  
  
 end if  

deagon

Posts: 31
Posted: 10/29/2007, 9:59 AM

Thanks JimmyCrackedCorn,

Thanks for the informatrion and the website URL.
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 10/29/2007, 10:42 AM

Quote deagon:
Thanks JimmyCrackedCorn,

Thanks for the informatrion and the website URL.

You're quite welcome.

Walter's example is even simpler if you know your numbers will never have a "." in them prior to you adding the suffix.
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
wkempees


Posts: 1679
Posted: 10/30/2007, 8:13 AM

JCC, good one.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
deagon

Posts: 31
Posted: 11/01/2007, 10:16 AM

The Code works great but one small issue remains. I've tried many ways to come at this but it just doesn't work properly. I'm trying to add a number to the Jobnum lets say 4000 is the number. When I add another job with the same PO number it should be 4000.1 that works fine. But when I add another unit to the excisting PO number the jobnum should be 4000.2.
I've tried the below logic if number is => then add .2, it adds it after so the number is 4000.1.2.
How do I get the number to go from 4000.1 to 4000.2? I understand the nesting thanks to all your help, but this is just a little over my head?

If Right(Jobstorage20.JobNumAdd1.Value,2) <> ".1" AND Right(Jobstorage20.JobNumAdd1.Value,2) <> ".i" AND Right(Jobstorage20.JobNumAdd1.Value,2) <> ".r" Then

If Jobstorage20.Submit1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & ".1"
If Right(Jobstorage20.JobNumAdd1.Value,2) => ".1" Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value + ".2"
Elseif Jobstorage20.inspection1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & ".i"
Elseif Jobstorage20.repair1.Value = True Then
Jobstorage20.JobNumAdd1.Value = Jobstorage20.JobNumAdd1.Value & ".r"
Else jobstorage20.JobNumAdd1.Visible = True
End If
End If
End if
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.