Why the datas from the .dbf file (table) are not displayed?  
Author Message
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Hi all

Need help very badly.. I purely have no idea where i go wrong.

I'm trying to get the datas (such as CHEVSINSMZ 100,CHEVSINSMZ 100, CHEVSINSMZ 101, CHEVSINSMZ 102, etc) from the table (.dbf) display and then trim into "CHEVSINSMZ 100 & 101 & 102 itself.

What i get the result on {.xdf_bl.value= OutPutSTring} of the form is (1)_________ when testing this form. Why cannot the datas be shown on the text field when searching for the value in the .dbf

_-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-_

tnfjob is the name of the table. Jt_hblno is an attribute of the table (.dbf)in the form. It is like something that originally contains CHEVSINSMZ 100,CHEVSINSMZ 100, CHEVSINSMZ 101, CHEVSINSMZ 102, etc in the column...

LOCAL InputString, CommaPos, i, SpacePos, PrefixString, BlNo

select tnfjob

STORE 0 TO CommaPos, i, Counter, SpacePos
LOCAL ARRAY xAr[1]
xAr[1] = ""
PrefixString = ""
BlNo = ""
InputString= Jt_hblno ** Retrieve the datas from the (.dbf) table.
CommaPos = AT(",",InputString)
SpacePos = AT(" ", InputString)
PrefixString = SUBSTR(InputString, 1, SpacePos - 1)
DO WHILE CommaPos > 0
Counter = Counter + 1
BlNo = STRTRAN(SUBSTR(InputString,1, CommaPos-1), PrefixString, "")
IF ASCAN(xAr, BlNo) = 0
i = i + 1
DIMENSION xAr[ i]
xAr[ i] = BlNo
ENDIF
InputString = ALLTRIM(SUBSTR(InputString,CommaPos+1))
CommaPos = AT(",",InputString)
ENDDO
BlNo = STRTRAN(InputString, PrefixString, "")
IF ASCAN(xAr, BlNo) = 0
DIMENSION xAr xAr[i+1] = ALLTRIM(BlNo)
Counter = Counter + 1
ENDIF
OutPutString = "("+ALLTRIM(str(Counter))+") " + PrefixString + " "
FOR j = 1 TO ALEN(xAr)
IF j = 1
OutPutSTring = OutPutSTring + xAr[j]
ELSE
OutPutSTring = OutPutSTring + " & " + xAr[j]
ENDIF
NEXT j


.xdf_bl.value= OutPutSTring ** Display the information on the form**

_-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-__-_-_-_

Appreciate your kindest help..

Millbear




Visual FoxPro2  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Your code is obscure and I couldn't understand exactly what you're trying to do. Form code and description I think something like this:

Create Cursor myTable (myData m)
Insert Into myTable Values ;
("CHEVSINSMZ 100,CHEVSINSMZ 100, CHEVSINSMZ 101, CHEVSINSMZ 102")

Local lcMyStr
lcPrefix = "CHEVSINSMZ"
lcMyStr = ;
Strtran(m.lcPrefix + ' ' + ;
chrtran(Strtran(myTable.myData,m.lcPrefix,''),;
', ','&'),'&',Padc('&',3))

m.lcMyStr

Even if this is really what you want please note that storing data like this is not suggested in the first place.


 
 
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

HCetinBasoz

I have put a simple website to describe how the form works.

http://www.geocities.com/ms_visualfoxpro6/index.html

Hope that it can help u to understand what I'm trying to achieve.

* It's written in VPF version 6.

Thanks again.



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Sorry but it doesn't help any better.
 
 
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Sorry but it doesn't help any better.

Is my form difficult to understand



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

I didn't understand anything trying to correlate to your question. Maybe someone else may understand.
 
 
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

hmmm.. i realised i missed out some important points.. Sorry, I could not explain well..

I try other way around one more time and hope that u r trying to get what I'm asking.

I just updated the simple website - http://www.geocities.com/ms_visualfoxpro6/index.html  - .. As u see, the first image (on the top) is a table where is being stored like that..

On the 2nd image, the name of the Text Box beside B/L No: is jt_hblno.

Originally, I put the line as highlighted.

STORE 0 TO CommaPos, i, Counter, SpacePos
LOCAL ARRAY xAr[1]
xAr[1] = ""
PrefixString = ""
BlNo = ""
InputString= "CHEVSINSMZ 99, CHEVSINSMZ 100, CHEVSINSMZ 101, CHEVSINSMZ 101"
CommaPos = AT(",",InputString)

I tested this part. It can work. The result on B/L NO. is (4) CHEVSINSMZ 99 & 100 & 101  

 

So, since CHEVSINSMZ 99, CHEVSINSMZ 100, CHEVSINSMZ 101, CHEVSINSMZ 101 are being stored in the table (image 1 on the top), I replaced it with InputString= jt_hblno.  When I tested it, the textbox of B/L NO. turns out to be blank (2nd image). 

Is there any other ways to modify this part to get the datas frm the table to display on the B/L No.

 



 
 
yanyee





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

why after select table

there is no go top and do while !eof()

so how u go thru all data in your table



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Assuming those 2 textboxes are thisform.txtJobNo and thisform.txtBlNo:

Local ix
Local Array aJob[1]
Select Distinct jt_hlbno, Val(Substr(jt_hlbno,At(' ',jt_hlbno))) ;
  From tnfJob ;
  WHERE jt_jobno == Thisform.txtJobNo.Value ;
  order by 2 ;
  INTO Array aJob
If _Tally > 0
  Thisform.txtBlNo.Value = Trim(aJob[1,1])
  For ix = 2 To _Tally
    Thisform
.txtBlNo.Value = Thisform.txtBlNo.Value + ;
    ' &'+;
    TRIM(Substr(aJob[m.ix,1],At(' ',aJob[m.ix,1])))
  Endfor
Else
 Thisform
.txtBlNo.Value = ''
Endif

PS: Your data structure doesn't look very good. For example this code would break when the prefix ("CHEVSINMSZ") have a single space in it.


 
 
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Thank u so much.

I followed your suggested codes but modifed a little. Now it pretty works.

Hopefully can store the invoice details into another table. That way, I have to call out the existing invoice number to amend manually in another form..

BTW, with these prefix (Thisform. ), the form cannot run well and produces errors - "Unknown member <any txt> ".. Can explain why does it produces errors like that



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Because there is not a member named the way I did. There is no problem in the syntax I sent. I assumed you had a textbox control on form named txtJobNo. If it really existed you can refer to it as:

thisform.txtJobNo

In other words the form (thisform) would have a member named txtJobNo.


 
 
MillBear





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Hi,

When clicking on the command button "Save", the program module got hanged on my own PC. But there is nothing wrong with it when testing on another PC. I notice that there are a few unwanted files such as 56546375.tmp in the folder of my own PC. Why is it cause problem and what's the tmp files abt

Thanks



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Why the datas from the .dbf file (table) are not displayed? Top

Ask a new question on a new thread.

.tmp files are temporary files created by applications. You can delete them. If application shuts down noramlly it'd clean up itself.