Welcome! Log In Create A New Profile

Advanced

capture the name of the fields in a query

Posted by Davi 
Davi
capture the name of the fields in a query
November 06, 2008 03:35AM
There is the possibility of putting the name of the field to a query or table inside a combo box? I would like to catch the name fields of food and a combo box to develop a screen filter

Thank you
Malcolm
Re: capture the name of the fields in a query
November 07, 2008 11:34PM
Hi Davi

If you mean having a 'hidden' column in data source of a combo which contains a field name, while the displayed value is a caption,
then you can either have an extra column in the data source which is not
included in the displayed values, or if you are manually adding items to the combo list, check out gLink.

If you actually want the field names from a query to put into the combo,
check out HListItem() to get a delimited list.

Cheers

Malc
Davi
Re: capture the name of the fields in a query
November 10, 2008 09:44AM
It worked well with Hlistitem, meanwhile, returned several information (item name, type, size, caption) I like it to return only the Caption

I'm using as follows:


// Retrieve the items of a file found in the current analysis
ItemList is string
ItemList = HListItem(Query_test, hLstDetail)

// Adds the list of items to COMBO1
ListAdd(COMBO_Combo1, ItemList)

Thanks
Malc
Re: capture the name of the fields in a query
November 10, 2008 11:55AM
Hi Davi

You will need to do a bit of preprocessing:

LOCAL
lsItems is string = ""
laItems is dynamic array of 0 by 6 string
liItems is int = 0
liItem is int = 0


lsItems = HListItem(Query_test, hLstDetail)
StringToArray(lsItems,laItems)
liItems = ArrayInfo(laItems,tiNumberRows)

FOR liItem = 1 TO liItems
// hLstDetail is specified as:
// Name of Item 1 + TAB +
// Type + TAB +
// Hyper File Type + TAB +
// Size> + TAB +
// Number of Subscripts + TAB +
// Caption + CR + ...

// 6th value is caption, so...
ListAdd(COMBO_Combo1, laItems[ liItem, 6])

// should you wish to reference the item name in code,
// try adding glink with name value
// ListAdd(COMBO_Combo1, laItems[ liItem, 6] + gLink(laItems[liItem,1])

END


HTH

Malc
Piet van Zanten
Re: capture the name of the fields in a query
November 11, 2008 06:04PM
Hi Davi,

Just omit the hLstDetail.

Regards,
Piet
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: