Normal Topic Sub Form programming question (Read 1641 times)
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Sub Form programming question
Jan 26th, 2015 at 10:14pm
Print Post Print Post  
Hello,
I have an inventory database that is controlled by a work order database. Right now the work order database updates the inventory database with the last sold on date  and work order number (to name a few). My desire is to have a continuing record log in the inventory database as apposed to just the last record. It would track every transaction of this part number. Would a sub form in the inventory database be suitable for this? if so what would I use in the work order database to write a new form to a sub form in inventory? or i'm i just going about this all wrong?
Thank you in advance for any advise.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Sub Form programming question
Reply #1 - Jan 30th, 2015 at 4:14pm
Print Post Print Post  
It depends on what you plan to do with the information. Do you just want to see a quick list of the activity for a particular part, or do you want to run activity reports across different parts?
  

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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Sub Form programming question
Reply #2 - Feb 6th, 2015 at 11:40pm
Print Post Print Post  
Hi!

Want a list of the activity for a individual part, to track history so we can determine what inventory levels should be.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Sub Form programming question
Reply #3 - Feb 9th, 2015 at 3:10pm
Print Post Print Post  
If you don't need to run reports against the individual transactions, a Text Editor bound to a text field will do fine and be more manageable than subrecords. If you do need to run reports for date ranges across multiple parts or suchlike, then go with subrecords.
  

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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Sub Form programming question
Reply #4 - Feb 11th, 2015 at 4:46pm
Print Post Print Post  
could you explain the text editor idea? it sounds like what i'm looking for
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Sub Form programming question
Reply #5 - Feb 11th, 2015 at 7:29pm
Print Post Print Post  
Place a Text Editor element on your form bound to a new Text field.

When you want to add a log entry, do something like:

Code
Select All
var vLog as String

	vLog = @ServerDate() + ": " + "7000 widgets moved to Warehouse B"
	Log = vLog + @Newline() + Log 

  

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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Sub Form programming question
Reply #6 - Feb 11th, 2015 at 11:22pm
Print Post Print Post  
This would work if I was in the same database, My syntax would need to do it from different database.
I'm sure this is what I'm looking as apposed to a subform. not have to print its info at all.

Right now I'm working with XResultSetValue(vRSSinv, "WO", CallNumber) to write to the field, not sure what syntax to use.
« Last Edit: Feb 12th, 2015 at 3:19am by FlipGilbert »  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Sub Form programming question
Reply #7 - Feb 12th, 2015 at 5:39pm
Print Post Print Post  
Got it!
Looks like...
Code
Select All
vLog1 = (@ServerDate() + " : " + CallNumber + " : " + "Qty " + Qty1 + " : " + CompanyName)
vLog2 = @XLookup(@fn, brp_1, "Inventory!SKU#", "SoldToDate")
vLog3 = vLog2 + @Newline() + vLog1
XResultSetValue(vRSSinv, "SoldToDate", vLog3) 


And it works!!
Thank you for you help Erika, always a pleasure.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Sub Form programming question
Reply #8 - Feb 12th, 2015 at 6:44pm
Print Post Print Post  
Hello Flip,

Since you already have the external record just use @XResultSetValue() to get the SoldToDate element value. No need to use @XLookup() to get data from the same record that you have in the XResultSet.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Sub Form programming question
Reply #9 - Feb 12th, 2015 at 11:40pm
Print Post Print Post  
HI RAY!
Thanks for the pointer


Code
Select All
// on status exit  ############################################################


Subroutine Completed( )

var vPartNo as String
Var vRSSinv as Int
var vLog1 as String
var vLog2 as String
var vLog3 as String

If JobType = "ESTIMATE"
	{
		@Msgbox("Are you having a bad day?", "You are trying to post inventory to an ESTIMATE", "I cant let you do that")
	}

If (JobType <> "ESTIMATE") And @FormResultSetTotal("Inventory:(Update)") = -1 Then
			{
				Flag = ""
				If ((Not @IsBlank(qty1)) and (Not @IsBlank(brp_1)) and @IsBlank(Post1) and (not @IsBlank(Location1)))
					{
						vRSSinv = @XResultSetSearch(@FN, "Inventory", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!SKU#=" + brp_1)

						If vRSSinv > -1
							{
								If @XResultSetTotal(vRSSinv) = 1
									{
										If @XResultSetLocked(vRSSinv) = 0
											{


												If Location1 = "Shop"
													{
														XResultSetValue(vRSSinv, "Shopqty", @TN(@XResultSetValue(vRSSinv, "Shopqty")) - Qty1)
														XResultSetValue(vRSSinv, "shopsales", @TN(@XResultSetValue(vRSSinv, "shopsales")) + Qty1)
														XResultSetValue(vRSSinv, "SalesShop", @TN(@XResultSetValue(vRSSinv, "SalesShop")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "2-T"
													{
														XResultSetValue(vRSSinv, "truck_2", @TN(@XResultSetValue(vRSSinv, "truck_2")) - Qty1)
														XResultSetValue(vRSSinv, "trk2sales", @TN(@XResultSetValue(vRSSinv, "trk2sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales2", @TN(@XResultSetValue(vRSSinv, "sales2")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "3-T"
													{
														XResultSetValue(vRSSinv, "truck_3", @TN(@XResultSetValue(vRSSinv, "truck_3")) - Qty1)
														XResultSetValue(vRSSinv, "trk3sales", @TN(@XResultSetValue(vRSSinv, "trk3sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales3", @TN(@XResultSetValue(vRSSinv, "sales3")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "4-T"
													{
														XResultSetValue(vRSSinv, "truck_4", @TN(@XResultSetValue(vRSSinv, "truck_4")) - Qty1)
														XResultSetValue(vRSSinv, "trk4sales", @TN(@XResultSetValue(vRSSinv, "trk4sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales4", @TN(@XResultSetValue(vRSSinv, "sales4")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "5-T"
													{
														XResultSetValue(vRSSinv, "truck_5", @TN(@XResultSetValue(vRSSinv, "truck_5")) - Qty1)
														XResultSetValue(vRSSinv, "trk5sales", @TN(@XResultSetValue(vRSSinv, "trk5sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales5", @TN(@XResultSetValue(vRSSinv, "sales5")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "6-T"
													{
														XResultSetValue(vRSSinv, "truck_6", @TN(@XResultSetValue(vRSSinv, "truck_6")) - Qty1)
														XResultSetValue(vRSSinv, "trk6sales", @TN(@XResultSetValue(vRSSinv, "trk6sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales6", @TN(@XResultSetValue(vRSSinv, "sales6")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "7-T"
													{
														XResultSetValue(vRSSinv, "truck_7", @TN(@XResultSetValue(vRSSinv, "truck_7")) - Qty1)
														XResultSetValue(vRSSinv, "trk7sales", @TN(@XResultSetValue(vRSSinv, "trk7sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales7", @TN(@XResultSetValue(vRSSinv, "sales7")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "8-T"
													{
														XResultSetValue(vRSSinv, "truck_8", @TN(@XResultSetValue(vRSSinv, "truck_8")) - Qty1)
														XResultSetValue(vRSSinv, "trk8sales", @TN(@XResultSetValue(vRSSinv, "trk8sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales8", @TN(@XResultSetValue(vRSSinv, "sales8")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "9-T"
													{
														XResultSetValue(vRSSinv, "truck_9", @TN(@XResultSetValue(vRSSinv, "truck_9")) - Qty1)
														XResultSetValue(vRSSinv, "trk9sales", @TN(@XResultSetValue(vRSSinv, "trk9sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales9", @TN(@XResultSetValue(vRSSinv, "sales9")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "10-T"
													{
														XResultSetValue(vRSSinv, "truck_10", @TN(@XResultSetValue(vRSSinv, "truck_10")) - Qty1)
														XResultSetValue(vRSSinv, "trk10sales", @TN(@XResultSetValue(vRSSinv, "trk10sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales10", @TN(@XResultSetValue(vRSSinv, "sales10")) + (ListPrice1 * Qty1))
													}
												Else If Location1 = "11-T"
													{
														XResultSetValue(vRSSinv, "truck_11", @TN(@XResultSetValue(vRSSinv, "truck_11")) - Qty1)
														XResultSetValue(vRSSinv, "trk11sales", @TN(@XResultSetValue(vRSSinv, "trk11sales")) + Qty1)
														XResultSetValue(vRSSinv, "sales11", @TN(@XResultSetValue(vRSSinv, "sales11")) + (ListPrice1 * Qty1))
													}
												Post1 = "X"
												XResultSetValue(vRSSinv, "QTYToDate", @TN(@XResultSetValue(vRSSinv, "QTYToDate")) + Qty1)
												XResultSetValue(vRSSinv, "ChangedForm", Post1)
												XResultSetValue(vRSSinv, "partsdept", Post1)
												XResultSetValue(vRSSinv, "reason", "Posted")
												XResultSetValue(vRSSinv, "DoneBy", sUserId)
												XResultSetValue(vRSSinv, "datemod", @date)
												vLog1 = (@ServerDate() + " : " + CallNumber + " : " + "Qty " + Qty1 + " : " + CompanyName)
												vLog2 = @XLookup(@fn, brp_1, "Inventory!SKU#", "SoldToDate")
												vLog3 = vLog2 + @Newline() + vLog1
												XResultSetValue(vRSSinv, "SoldToDate", vLog3)
												ReadOnly(Qty1,2);ReadOnly(brp_1,2);ReadOnly(location1,2);ReadOnly(listprice1,2);ReadOnly(des1,2)
											}
										Else
											{
												@MsgBox("An Inventory Form you want to post to is open by another person", "", "Please have them close it and try again")
												Flag = "X"
												CallStatus = "OPEN"
											}
									}
								XResultSetClose(vRSSinv)
								vPartNo = ""
								vRSSinv = ""
								vLog1 = ""
								vLog2 = ""
								vLog3 = ""

							}
					} 

 



I have this do it 13 more times for a total of 14 lines.
I did this long before subforms now i'm afraid to change over, It takes forever to compile.
First time using the text editor field, where has that been all my life!?

Thank you Both!
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged