I'm a little stuck. If I remove the forall it works perfectly but when I add forall it gives a failure that the column is not accessible. The even stranger part is that I use the same gallery and forall/patch above with a different table but edit records instead of create new and have no problems. I tried changing this to edit but I still get the error. Any help is appreciated.
ForAll(galWorkItems_1.AllItems,
Patch(
'Project Activities',
Defaults('Project Activities'),
{
Project: gblProject,
// 'Work Item': Label1.Text,
'Work Item':LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text),
Name: Left(
WorkItemUpdate_1.Text & ": " & lblWorkItemTitle_1.Text
,
100
),
Description: WorkItemUpdate_1.Text & ": " & lblWorkItemTitle_1.Text,
Code: "0" //code for custom update
}
)
)
I'm convinced I'm forgetting something simple but for the life of me can't see it.
Thanks
Solved! Go to Solution.
So it is definitely some issue with the table itself. I plugged other tables in that worked. I tried disconnecting and reconnecting the table but that didn't help. I ended up making a second table to mirror this one and wrote to that one successfully and will have to go back and rewrite everywhere else I write to the old one to the new one... Wish I could figure out what the preventing issue was but never figured it out.
not sure what the issue is. I am just guessing here. Maybe accessing the lblworkitem is causing the issue
how about a set statement before Forall
Set(myVar, lblworkitemtitle_1.text);
and then use this myVar inside the ForAll statement
@jesudas If the label is inside the gallery, this will not work.
@PaulBI what is gblProject?
Is it a field in the Gal.AllItems? If Yes, create a label and set it to ThisItem.gblProject and use label.Text in your ForAll
If it is a global variable, ignore the above (I am assuming you are adding work items to a project)
BTW, which column gives the error of not being accessible?
Thanks for the quick replies. To answer the first question, @jesudas unfortunately lblworkitemtitle_1.text is inside the gallery. For the second question @HimanshuSSharma gblProject is a global variable. Attached is the full error message but it never calls out specifically which column is causing the issue.
I do have an update but not a fix yet. So I found that if I collect the gallery and select a specific column out of it, the error is removed, but nothing is written. Progress but still not able to make it work. Any ideas?
Collected more information just now. I changed the column to something that is unique for each row in the gallery. If I change and update just one row it works. If I update more than one (say 3), it recognizes that and will create 3 records but each record is identical (typically looks to be the last row I edited) and doesn't record the other two at all. Hopefully this means something and I can start to figure out how to correct?
So it is definitely some issue with the table itself. I plugged other tables in that worked. I tried disconnecting and reconnecting the table but that didn't help. I ended up making a second table to mirror this one and wrote to that one successfully and will have to go back and rewrite everywhere else I write to the old one to the new one... Wish I could figure out what the preventing issue was but never figured it out.
Okay, so one thing to note here. You are using Forall on colChangedItems but are referring to Label1.text and other labels as well. These labels should not be in a Gallery. If they are in the gallery, they will always pick from the first gallery item.
Your earlier method of looping over gallery items suggested something else. if you switched to collection, you should switch the values passed in the patch function accordingly.
Yeah I was trying everything I could think of (collecting and using a collection, connecting and reconnecting datasource, etc) even if I deleted everything after the defaults statement it still errored out so the issue originates before pulling all those labels, etc in. My added datasource hasn't had any issues since, doesn't make any sense but it's working.
Ok I really can't explain this. The new table I created worked great from Wednesday to this afternoon. Now it is giving the exact same error as the last one did saying that the column is no longer accessible... Something is changing in the table that causes this error to happen, but I have no idea what could be doing it...
User | Count |
---|---|
160 | |
91 | |
68 | |
64 | |
63 |
User | Count |
---|---|
210 | |
157 | |
93 | |
81 | |
71 |