Hi!
I'm working on a database that imports it's records from different files. What I'm trying to achieve is to do the following code:
There is a table (podsaltemp) with a field (Man) that repeats its value about 20 times. It's a character field with the following structure as an example �000012�. I want to add all this characters to an array.
Dim tbl as P
Dim ManTemp as C
Dim Shared ManArr as C
tbl = table.open("podsaltemp")
ManTemp = tbl.record_content_get("Man")
Then I found this method to remove the duplicates.
ManTemp = sortsubstr(ManTemp, crlf() )
ManArr = *remove_duplicates(ManTemp)
After having this list, I would like to use each value (in order) to add another field (Fob with a structure of 000.00 as Number), with which I found this function useful,
Dim TotalMan as N
TotalMan = TABLESUM("podsaltemp.dbf", "Man = '� + ManArr +�' ", "Fob")
Now what I'm missing (if the code is right, because I have no way to check if it's working the way I'm expecting because of the missing code fragments) is to add only the FOB of the records that apply according to the following �code�:
Two fields must be checked, Man and Pro
If Man = ManArr and Pro = .first(P) (I assume this is the way to check that the first letter of the Pro field is a P) Then
Add the FOB to TotalManP
Else, If Man = ManArr and Pro = .first(T) Then (trying to nest the flow control)
Add the FOB to TotalManT
Else, If Man = ManArr and Pro = .first(B) Then
Add the FOB to TotalManB
End If
At the end, I hope to have 3 total values.
This must be done for all the numbers stored in the array at the beginning, so I suppose there must be a For flow control.
So if I have lets say, 30 different numbers in the Man field, and 3 possible totals from each, I would need a place to store this in a order way (may be an array, or a table) to then take them and post them in a report.
It's pretty complex... but if you happen to know just a tiny part of the solution for the whole problem, that would be great.
Thank you in advance, I had been breaking my head with this problem for many hours.
Enrique.
I'm working on a database that imports it's records from different files. What I'm trying to achieve is to do the following code:
There is a table (podsaltemp) with a field (Man) that repeats its value about 20 times. It's a character field with the following structure as an example �000012�. I want to add all this characters to an array.
Dim tbl as P
Dim ManTemp as C
Dim Shared ManArr as C
tbl = table.open("podsaltemp")
ManTemp = tbl.record_content_get("Man")
Then I found this method to remove the duplicates.
ManTemp = sortsubstr(ManTemp, crlf() )
ManArr = *remove_duplicates(ManTemp)
After having this list, I would like to use each value (in order) to add another field (Fob with a structure of 000.00 as Number), with which I found this function useful,
Dim TotalMan as N
TotalMan = TABLESUM("podsaltemp.dbf", "Man = '� + ManArr +�' ", "Fob")
Now what I'm missing (if the code is right, because I have no way to check if it's working the way I'm expecting because of the missing code fragments) is to add only the FOB of the records that apply according to the following �code�:
Two fields must be checked, Man and Pro
If Man = ManArr and Pro = .first(P) (I assume this is the way to check that the first letter of the Pro field is a P) Then
Add the FOB to TotalManP
Else, If Man = ManArr and Pro = .first(T) Then (trying to nest the flow control)
Add the FOB to TotalManT
Else, If Man = ManArr and Pro = .first(B) Then
Add the FOB to TotalManB
End If
At the end, I hope to have 3 total values.
This must be done for all the numbers stored in the array at the beginning, so I suppose there must be a For flow control.
So if I have lets say, 30 different numbers in the Man field, and 3 possible totals from each, I would need a place to store this in a order way (may be an array, or a table) to then take them and post them in a report.
It's pretty complex... but if you happen to know just a tiny part of the solution for the whole problem, that would be great.
Thank you in advance, I had been breaking my head with this problem for many hours.
Enrique.
Comment