PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM 23] Looper displays nothing on Android
[WM 23] Looper displays nothing on Android
Débuté par Anthony BLANCHETTE-P, 29 aoû. 2019 06:07 - 15 réponses
Membre enregistré
14 messages
Posté le 29 août 2019 - 06:07
Hello,

I've created a looper control linked to a HFSQL query. Everythings works like a charm on iOS or in the Android emulator, but when I build an run the application on an Android device, the looper control displays nothings at all. In addition, when I pull to refresh the looper, the resfresh indicator shows up, but never disappear.

Any idea on what might cause this issue ?

--
Anthony
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 30 août 2019 - 15:58
Hi Anthony BLANCHETTE-P

I can help you with the why it doesn't show anything.

Did you try to use the function
LooperDisplay(LOOP_Name1)



sometimes you need to do this in order to show something.
Also check if you have data on your table.
another thing it's the connection to the server.
If the table it's a classic HFSQL then you need to import it on your project on the steps for genering the apk or the iOS Project.

about the pull refresh I'm new at this so I don't know why that happend.

--
Best Regards
ARV
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 14:52
Hi ARV,

I'm using the Display function, but the object way : LOOP_Name.Display(). I'm not sure if does things diffently though. I'll try the other way around.

And, I'm not using the classic HFSQL file directly. I'm using a query that select records on the HFSQL file. Maybe I have to import them anyway ? I'll try that too !

Thanks for the reply.

--
Anthony
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 15:13
So, I tried pretty much everything you said and nothing is showing up.

Juste to be sure, I imported the HFSQL files located in Project Folder > Exe > Application Android. I kept the default settings : Read/Write, DB Repository, etc.





I tried by programming using the HFSQL functions directly on the query. There's a problem with the HReadFirst function. It returns false, but there's no error message. I just don't understand why it's returns false. Here's my code :





Thank you.

--
Anthony
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 03 septembre 2019 - 15:38
Hi Anthony BLANCHETTE-P

I guess I know what it's happening

1. Did you know if your tables have data on the device?
Try using an info with Hnbrec Like this
Info(HNbRec(TableName))

but using the device with the app.
if this shows 0 then the table it's empty on the data base of the device.

2. I assume that your Data Base all tables are Classic HFSQL and no Client Server so if your tables have no data and the first time you compile and install your app on the device it will have no data.

If you put data on the table on a updated for the app, compile and intall the app on the device it will no add more data or the ones you put it yourself (I'm talking the first time you install the app and try to update it I assume that you import it on the compile).

if it's the first time the device will have the app and the tables of HFSQL Classic have data then the device will have it (if you import it), but if you add more on your own and you will updated the app, this time it will keep the first time you compile and install, it will no add the new data you want to show, so there's some ways to updated or put more data for this method:
- Add it in the app using the device
- (this method needs to be use for a expecific topic because it may have conflics for data or losing data) using fExtractResources with fDataDir and the name of the table with .fic and .ndx this will erase all the data of the table and replace it with the data you put on the compile.

Make sure you have data on the device, because what you see on Exe (emulation mode) and what you see on the device no necessarily are the same, it all depends if you import it and if you install it the first time on the device. Then later of this it will needs the help of the device to add it or the function fExtracResource to updated (replace) the data, but this last I mention needs to be use with really attention.

Hope this help you, if you have more question feel free to do it!

--
Best Regards
ARV
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 16:05
I will investigate on that. In the context of the application I'm developping, the files must be empty the first time I install the application. I add data to the files based on the user interests and rights (to avoid giving him access to data he/she don't want or shouldn't have access to).

Anyway, I'll keep you up to date !

Thank you.

--
Anthony
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 16:20
You're right. There is no data.

But, I want to make sure that you know I am using a QUERY, not a classic HFSQL file directly.

I'm not sure to understand your second point with the HExtractResource and all. I've never use those. And, since I'm using a query, is it relevant ?

Thank you.

--
Anthony
Message modifié, 03 septembre 2019 - 16:21
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 03 septembre 2019 - 17:20
Hi Anthony BLANCHETTE-P

the Query will launch what the table have, since the table have nothing then the query will show nothing.
Why I'm asking about the table if it is Classic or Client/Server because if it is classic it will need more explanation about data.
If the tables are connected to a server using Client/Server then you need to focus on the data of your server.

now about fExtractResource it's just to have an option,. it could be relevant if the project it's based on Classic Data base but for now it will no be relevant then.

Now that you mention the app first time the tables need to be empty then it's not necessary to import it always on your project, the project will create it automatic anyways.

Then all you need to do it's create a window with edits and a button.
These edits need to be the fields you want to show on your looper.
Then on the button you will need to assign all the files of your table with the edit like this:
TableName.Name = EDT_Name

then you will need to add the data
HAdd(TableName)

another way to fill data on the table its with
The edit needs to be link to the table and the field you want to assign data this could be done on the description of the edit on the Link tab, search the table and then the field
then on the code of the button you only need to do
ScreenToFile()
then below this use HAdd(TableName)
and it will assign all of the data you want on the fields of your table and save it.

with this you will fill up the data on your table on the Data Base of your device.

then go back to the looper with the query
and then you will see data.

now the data you are saving with HAdd, the table you mention on this Hadd needs to be the from of your query to make this work.

Remember, then you compile and install your app your tables will be always empty so you need to add it by yourself of by the user

now this part it's important to know how it's your Data base, how is the enviroment if it is Classic or Client Server
Classic = the tables are in red and all it's local (on emulation the data will be on Exe file, on the device it will located on a personal file where no one can access only the app)
Client Server =the tables are in yellow, the files are on a server, you can access to those files using Control Center HFSQL or using WDMap on the analysis of your project.

If you have more question, feel free to do it!

--
Best Regards
ARV
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 19:22
Hi ARV,

Ok, when I called the function HNbRec, it was on the query. The files are not empty, they have like 2000 records each. Anyway, I tried to link my Looper to one of the HFSQL file instead of the query, and It worked : I saw 2000 records in my Looper. So, clearly, my HFSQL files are ok. It's something with the query. I'll send you some screenshots. Maybe it will help !

Here's the query :

https://hostimage.windev.io/images/queryDescription_d70021f07b7fe44741385e848dce4fdc.PNG

Here's the looper description. As you can see, it's filled using the query :

https://hostimage.windev.io/images/looperDescription_b7a691d42e96a3e074c4ebd3e092a44f.PNG¸

Finally, here's the update procedure. It's the procedure called within the pull to refresh event :





Sorry for the french !

Thank you.

--
Anthony
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 03 septembre 2019 - 22:13
Hi Anthony BLANCHETTE-P

Sorry I can't see anything.

Don't worry about the French I could manage how to solve the issue about idioms (just using google translate)

So if you could see through the file then the problem REALLY is on the query.

Do you link the attributes to the fields on the query too?

also could you please send me the code SQL of your query maybe the problem it's on the code.


Good luck!

--
Best Regards
ARV
Membre enregistré
14 messages
Posté le 03 septembre 2019 - 22:26
Hi ARV,

Yes I do link the attributes to the fields. I tried directly on the fields and through the Looper attributes. Doesn't change anything.

One thing I notice with the query is that as soon as I have multiple files (in other words, as soon as there's a join between to table), it doesn't work anymore.

Here's the SQL :





Thank you.

--
Anthony
Message modifié, 03 septembre 2019 - 22:28
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 04 septembre 2019 - 15:29
Hi Anthony BLANCHETTE-P,

I don't see anything wrong with the query.

Do you Try to erase the part of the concat and that?
Just to see if that works.

Did you see the fields of the joins like NIL and Code are the same type?
Did you see if on those tables at least you have one data that could match the Join?

Good Luck

--
Best Regards
ARV
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 04 septembre 2019 - 15:39
Hi Anthony BLANCHETTE-P

Another thing I need to be sure.
How it's your Data base on your windev mobile project?.
Do you have tables from a server?.
or You just create the tables on the project and then let it be like that.

Good Luck

--
Best Regards
ARV
Membre enregistré
14 messages
Posté le 09 septembre 2019 - 14:16
Hi ARV,

Sorry for the latency.

I'll check if the data types are the same. Good call !

And the tables were created on the project since a huge part of the application needs to work offline.

Thank you.

--
Anthony
Membre enregistré
14 messages
Posté le 09 septembre 2019 - 17:22
Hi ARV,

I finally got it ! After one week of trial and error, I finally got it.

After a long session of trial and error with my IT, we found out that a SQL WHERE clause between two specific HFSQL tables was causing the problem. Basically, this table, named EntityType, hold an image path for each type of entity. We check if the data types were correct and if there was something problematic with the table, but we couldn't find anything, which is still very wierd and anoying. What I did is that in my request, I just deleted any trace of the EntityType table and in the Row Display event of the looper, I'm using a SWITCH condition to select which image to display.

Anyway, the problem is still unknown to me, which is kind of sad. But, it's only a prototype and now it works. So, I'm just going to move on !

A huge thanks for your time, it is very appreciated !

See you soon.

--
Anthony
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 09 septembre 2019 - 18:04
Hi Anthony BLANCHETTE-P

Glad to read it!

Hope you can get the problem itself another day.

--
Best Regards
ARV