Forums

This topic is locked

About Repeating

Posted 04 May 2003 13:42:12
1
has voted
04 May 2003 13:42:12 Talal Nabil posted:
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

Replies

Replied 05 May 2003 11:30:58
05 May 2003 11:30:58 Talal Nabil replied:
Find below the asp script I made and also find my exact question in the script:


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

Set CmdSalesComponents = Server.CreateObject("ADODB.Recordset"
MYSQL = "SELECT * FROM required_components WHERE Product='" & CmdProducts("Product" & "'"
CmdSalesComponents.Open MYSQL, DataConn

Do While Not CmdSalesComponents.EOF

Raw_Material = CmdSalesComponents("Quantity" * CmdSalesComponents("Amount"* CmdSalesComponents("Weight"

If CmdSalesComponents("Stock" - Raw_Material => 0 Then
Response.Write CmdSalesComponents("Component" & " = True"
Else Response.Write CmdSalesComponents("Component" & " = False"
End IF

<BR>

CmdSalesComponents.MoveNext
Loop

<BR>

//Here I want to check if all the components are true then Response.Write CmdProducts("Product" & " is true" Else Response.Write CmdProducts("Product" & " is False"//

<BR><BR>

CmdProducts.MoveNext
Wend
CmdSalesComponents.Close
Set CmdSalesComponents = Nothing
CmdProducts.Close
Set CmdProducts = Nothing
DataConn.Close
Set DataConn = Nothing

Reply to this topic