Showing results for 
Search instead for 
Did you mean: 
Not applicable

Offline collection

Hi All, 

I am creating app for offline mode and have two entities(Journey, and Triage)in CDS datasource.

Online scenario-  I have two screen, on one screen I fill the data and record gets created in journey entity. And I have second screen on which I fill more detail about particular record and when I submit, record gets created into Triage  entity with GUID column(Unique Identifier). Now, I have lookup field in Triage called "Journey Lookup" which is nothing but the GUID of the recent record inserted by the journey which we submitted on first screen.

How can I do that in offline mode?

In offline mode,  the issue I am facing is I have created collection and I have created GUID using GUID function in journey entity, and which I a inserting into "Journey_ID" text column in Journey entity. And using that column's result I was trying to link two entities.After inserting data If I come online then I patch record into entity and clear the collection and because of clearing the collection I am not able to link.

Code I used in patch of Triage entity-

'Journey Lookup': LookUp(Journeys,Journey_ID=Label12_2.Text)

In Label12_2 I am fetching the Guid of recent record which I created. And it is giving blank because I am clearing the collection. So it's not working.

Any help is appreciated

How can I achieve that?

Dual Super User
Dual Super User

Two suggestions

1) When working online the app needs to be designed to use a local collection(s) for everything. Then when it detects that its online it syncs that collection(s) back to the online data source.  So as long as you have linked records all those records need to remain in the local collection(s).

2) Your other problem I think is coming from using a GUID. Guids are often the index field for records and are managed by the online data source.  So you can't just create a new GUID when you are offline and then expect CDS to use that as the key field.  I would recommend creating your own index field that you can manage for the linked record and let CDS do its own GUID when you go online.  Another issue with GUIDs is that '=' usually doesn't work if you try to evaluate the GUID  as a string.  So your lookup may not be working right.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Not applicable

Hi @Pstork1 ,

Thanks for your response!

I used index column but still it is not working.

If possible can you please provide me some example using index column considering my scenario for offline mode?

Thanks in advance.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,418)