Welcome! Log In Create A New Profile

Advanced

Help - How to make flexible table control on a window

Posted by Hafizh Kevin 
Help - How to make flexible table control on a window
January 11, 2021 03:10AM
We have project tasked to the team, the task is to create table control on a window (Just one window) and the table must able to show the record that retrived from query or datafile. We still not able to find solution to make the table control capable adding column and row automaticliy acording to datafile

To elaborate on what I meant, my team and I are trying to create a database manager app in Windev Mobile (for HFSQL), what we're tasked with is to make 2 windows, one window to choose which data table (the files within the analysis which exist in the database), and another window that will be used to manage (Create, Read, Update, Delete) the data within the table.

We have been able to create the first window, but the second window is what is currently confusing us, because we need to make it possible to use a window that contains a table that would expand/decrease the amount of columns based on the data table we loaded (for example "client data" data table has 5 data headers (client_name, client_address, client_phoneNum, client_type, client_eMail) , so the table should have 5 columns, and providers data table has 10 data headers so the table should have 10 columns) like how excel would act when we open different excel files

we would appreciate the help
Al
Re: Help - How to make flexible table control on a window
January 11, 2021 03:39AM
Hello Kevin

Look at "ControlClone" and "ControlCreate" in the help.
Also look at HListItem() to get a list of the file fields

There are also some file manager classes in the WXPerrts blog and you tube that may give you some more ideas
[blog.wxperts.com]

Regards
Al
Re: Help - How to make flexible table control on a window
January 11, 2021 05:58AM
Hello Al

First i want to thank you for responding my inquiry.

for this case "my team and I are trying to create a database manager app in Windev Mobile (for HFSQL)" we dicided to create new datafile (dfname and description) containing all datafile name on analysis (input manualy for every datafile name) until we can find other solution for this.

We still try to find solution when dfname is selected on table control, the qry/datafile will be displayed by flexible table that can fill itself with every column header and record from difrent datafile.

We check your advice to look for Control Create and Control clone, unfortunately Control Create is not compatible with Windev Mobile For Android/Tablet, for HListItem it is unable to retrieve table name in my opinion. but solution from WXPerrts blog can be used after the problem above solved.

Regard
Hafizh Kevin
Al
Re: Help - How to make flexible table control on a window
January 11, 2021 06:12AM
Hello Kevin

You don't have to input the data manually.

Just use Windev and hlistItem() to collect the data and maintain it.
Here is a link to a Windev repository post I made years ago - it is a bit rough but it will extract all the data in an analysis
[repository.windev.com]

Regards
Al
Re: Help - How to make flexible table control on a window
January 11, 2021 08:23AM
Hello Al

We are using Windev Mobile for Android, The solution you gave works perfectly on Windev but is not applicable on Windev Mobile, i got an error that says there is no equivalent function as such fSelect in Windev Mobile

Regards Kevin
Re: Help - How to make flexible table control on a window
January 14, 2021 08:48AM
Hello

We able to create flexible table, it will display table and column from difrent datafile. We are using BuildBrowsingTable to display column and FileToMemoryTable to display the record. The table control will adjust itself acording datafile we select. But it will cause problem when we try manage the data on the table (add, modify, delete)

FOR i = 1 TO arrAdd.Count()
q.arrAdd = edt
END

Note : q (datafile), arrAdd (is column on table) and edt (Edit Control value)

unfortunately it not allow us use "." on this line

q.arrAdd = edt // '.' operator not allowed on Unicode String Element

Any advice, how to fix this?



Edited 1 time(s). Last edit at 01/14/2021 08:51AM by Hafizh Kevin.
Re: Help - How to make flexible table control on a window
January 20, 2021 11:07AM
Hafizh Kevin Wrote:
-------------------------------------------------------
> Hello
>
> We able to create flexible table, it will display
> table and column from difrent datafile. We are
> using BuildBrowsingTable to display column and
> FileToMemoryTable to display the record. The table
> control will adjust itself acording datafile we
> select. But it will cause problem when we try
> manage the data on the table (add, modify, delete)
>
> FOR i = 1 TO arrAdd.Count()
> q.arrAdd = edt
> END
>
> Note : q (datafile), arrAdd (is column on table)
> and edt (Edit Control value)
>
> unfortunately it not allow us use "." on this
> line
>
> q.arrAdd = edt // '.' operator not
> allowed on Unicode String Element
>
> Any advice, how to fix this?

We decided to not use array of index for this. we do this manually by set condition for every datafile to get acces and get the value one by one. There long code for this IF condition, but we manage to create a single window app to manage database.

We still need advice if there solution to do array index for the case above. if there some solution that we can implement, we realy appreciated any help there?
BuildBrowsingTable is the function to use in my opinion.
you can acces the data by using

iCntRow=Table control.Count(toRow)
iCntCol=Table control.Count(toColumn)
For iRow=1 to iCntRow(table)
For iCol=1 to iCntRCol
// Get your data
edit=table[iRow][iCol]
end
end
Re: Help - How to make flexible table control on a window
February 15, 2021 05:53AM
Hello Niek,

Thank you for your response, by logic your code should have worked. We will try using it by following your code, if we found issue with it i will contact you. I hope you will kindly help us latter.

Best Regards
Kevin
Author:

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: