ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 4th, 2003, 02:23 PM
talal talal is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 talal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb Need Help in ASP and Repeat Region

Hey Guys,

I have a tough one here, I want to set an If statement for a repeated region inside a repeated region... Confusing?? OK

Here is the story:

First, I repeat all products which includes the repeated values of components of the product and multiply it by the quantity
So now I have total for each component per product

Now, I want to check if the amount of each component is in stock or not and If all the components of a product is available, Then add the product to next step

Then loop for the second product

Any clue

Reply With Quote
  #2  
Old May 5th, 2003, 10:36 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
So you run a loop to grab your products and quantity, and a loop for each product to get a list of components required for the product and how many components you would need for that quantity of products, and you want to take those results and check whether or not all the necessar components are in stock, correct?

Reply With Quote
  #3  
Old May 5th, 2003, 11:11 AM
talal talal is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 talal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exactly but ...

Thank you for your help, actually I did something which helped. Below is the original code plus the modification I made in bold but now I have another 2 problems (sorry if i'm asking too much )

Question No. 1: how to update the value of the onhold find it in bold and italic

Question No. 2: If one of the component is False then calculate the minimum quantity to produce based on the stock avilable for this component And if 2 or more components are false then calculate the minimum quantity to produce based on the stock avilable for each component and then select the minimum quantity

I'm sorry if it sounds stupid or confusing


<%
Set DataConn = Server.CreateObject("ADODB.Connection")
Set CmdProducts = Server.CreateObject("ADODB.Recordset")
DataConn.Open "dsn=medco-local;"
MYSQL1 = "SELECT * FROM sales_order_products WHERE MSO='" & Request.QueryString("mso") & "'"
CmdProducts.Open MYSQL1, DataConn
Do While Not CmdProducts.EOF

Set CmdSalesComponents = Server.CreateObject("ADODB.Recordset")
MYSQL2 = "SELECT * FROM required_components WHERE Product='" & CmdProducts("Product") & "'"
CmdSalesComponents.Open MYSQL2, DataConn
Dim Yes
Dim No
Yes = 0
No = 0

Do While Not CmdSalesComponents.EOF

Required = CmdSalesComponents("Amount")* CmdSalesComponents("Weight")
Available = CmdSalesComponents("Stock") - CmdSalesComponents("OnHold")

If Available / Required => CmdSalesComponents("Quantity") Then
Yes = Yes + 1
Else No = No + 1
End IF
%>
<%
CmdSalesComponents.MoveNext
Loop
%>
<%
If No = 0 then // Question No. 1

Do While Not CmdSalesComponents.EOF
Dim Component
Dim Onhold
Component = CmdSalesComponents("Component")
Onhold = CmdSalesComponents("OnHold") + (CmdSalesComponents("Amount")* CmdSalesComponents("Weight"))
Set CmdAddRecord = Server.CreateObject("ADODB.Recordset")
MYSQL3 = "SELECT * FROM raw_material WHERE Item='" & Component & "'"
CmdAddRecord.Open MYSQL3, DataConn, 1, 3
CmdAddRecord.Update
CmdAddRecord.Fields("OnHold") = OnHold
CmdAddRecord.Update
CmdAddRecord.Close
Set CmdAddRecord = Nothing
CmdSalesComponents.MoveNext
Loop

End If
%>
<%
If No //Question No.2
End If
%>
<BR>
<%
CmdProducts.MoveNext
Loop
CmdSalesComponents.Close
Set CmdSalesComponents = Nothing
CmdProducts.Close
Set CmdProducts = Nothing
DataConn.Close
Set DataConn = Nothing
%>

Reply With Quote
  #4  
Old May 5th, 2003, 11:48 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
You seem to be moving in the right direction on your own. Unfortunately there's no "elegant" way to handle these types of problems. You'll have to just write a function or two to perform the checks you want, and they'll be a mess of if statements i'm sure.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Need Help in ASP and Repeat Region


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT