Support Forum

Ask questions and get help from MobileTogether experts.
MobileTogether Product Information
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
TimJ  
#1 Posted : Tuesday, December 22, 2015 10:02:58 AM(UTC)
TimJ

Rank: Member

Groups: Registered
Joined: 12/22/2015(UTC)
Posts: 11
United Kingdom

Thanks: 1 times
I'm trying to find out whether an attachment exists within an Access Dbase using mobile together. The following in SQL works fine:
SELECT [D_Expenses_ID], Count([Attachments].FileName) AS [Num Attachments] FROM [D_Expenses] AS [D_Expenses] GROUP BY [D_Expenses_ID]
But I can't seem to find a way of doing it using Xpath in mobile together. I've tried using the base-uri, document-uri etc but no luck.

thanks
bbv  
#2 Posted : Wednesday, December 23, 2015 10:38:56 AM(UTC)
bbv

Rank: Administration

Groups: Registered, Administrators
Joined: 7/21/2014(UTC)
Posts: 495

Was thanked: 87 time(s) in 87 post(s)
You can use XPath in MobileTogether to access data already loaded into the trees. Any external access in XPath is intentionally prohibited, because loading of external data in MobileTogether is done completely by the server - not by the client. All loaded data is transferred from server to the client at once, and only when necessary in order to reduce communication overhead.

Therefore using the SELECT statement you should get a file name, and using Load File action you can then load the file to a tree. If the attachment file is an image, then you can path the file name as a source of your image.

Hope this helps. If you have a more detailed information or your sample design - we might be able to give more exact advices.


Altova MobileTogether Experts
TimJ  
#3 Posted : Wednesday, December 23, 2015 12:11:05 PM(UTC)
TimJ

Rank: Member

Groups: Registered
Joined: 12/22/2015(UTC)
Posts: 11
United Kingdom

Thanks: 1 times
Sorry, but the SQL statment run against my database gives me the id, and a zero or one to say whether there is an attachement. I don't believe I can use SQL in mobile together, and I've tried the xpath functions I thought that I would need to retrieve the filename and count it but I've not been able to do this. What should I use in mobile together to produce the equivalent SQL statement and therefore the same output?

thanks
bbv  
#4 Posted : Wednesday, December 23, 2015 4:53:38 PM(UTC)
bbv

Rank: Administration

Groups: Registered, Administrators
Joined: 7/21/2014(UTC)
Posts: 495

Was thanked: 87 time(s) in 87 post(s)
>I don't believe I can use SQL in mobile together
Of course you can!!! SQL support is one of its central features! MobileTogether comes with lots of SQL examples and documentation.

Now, it is clear that your original statement only tells you whether there is a file or not
Without having your database I can only guess what a correct statement would be, something like:

SELECT D_Expenses_ID, MAX([Attachments].FileName) FROM D_Expenses GROUP BY D_Expenses_ID

As I said, if you want us to really help, we will need your files.
TimJ  
#5 Posted : Wednesday, December 23, 2015 5:45:04 PM(UTC)
TimJ

Rank: Member

Groups: Registered
Joined: 12/22/2015(UTC)
Posts: 11
United Kingdom

Thanks: 1 times
Maybe I wasn't clear enough in what I meant. There is an SQL editor, and both the original SQL code that I posted and the one you have posted retrieves results (although my one is better for my purposes).

The problem is that I'm not sure how this SQL script and therefore these results can be used within a page because whenever I look at the app page design, the only source for a label is: enter it, connect it to a node, or use Xpath. Hence my original question of how I can write the SQL script in Xpath so I can attach it to a label and show/do something with the results. Or is there a way to convert or link the SQL script to a control instead of using Xpath?
TimJ  
#6 Posted : Wednesday, December 23, 2015 5:57:09 PM(UTC)
TimJ

Rank: Member

Groups: Registered
Joined: 12/22/2015(UTC)
Posts: 11
United Kingdom

Thanks: 1 times
Ok, I think I've figured out how to do it by adding another data source linked to the table and cross reference that. If this doesn't work, I'll let you know. Thanks
bbv  
#7 Posted : Wednesday, December 23, 2015 11:25:38 PM(UTC)
bbv

Rank: Administration

Groups: Registered, Administrators
Joined: 7/21/2014(UTC)
Posts: 495

Was thanked: 87 time(s) in 87 post(s)
I would like to suggest to at least watch some of the introductional videos

http://www.altova.com/mobiletogether/demos.html

The videos are intentionally held short, so that you don't need to spend too much time watching them. They cover simple topics, like using database in MobileTogether.
Users browsing this topic
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.