Hi all,
I'm pretty new to PowerApps and really enjoying all the posibilities it gives. I'm trying to built a sort of inspection app, where people can register results of inspections. Therefore I have created a SQL database with a few tables, including:
Now I want to make a button, saying "Create new work order" that does the following:
I'm having trouble with action 2. I looked at something with "Forall" and "Patch", but couldn't get it working
Below a screenshot of my work order screen. It shows the work order details from Workorder and below the related inspectionpoints from WoInsp.
Looking forward to your suggestions!
Matthijs
Solved! Go to Solution.
I'm not sure what happened over night, but now I am able to create the record. I think my SQL just had to refresh something (although I did press refresh on the powerapps database).
so far so good, thanks
Hi @mhulsegge ,
I am assuming that your are using NewForm(YourFormName) and you want to copy in additional information before saving the record? If so, you simply need to set the Default of the relevant control of your new Work Order form to the relevant value from Inspection. There are several ways of getting and setting this value - I will give you one piece of advice first - get rid of the "joining" table and make a direct relationship between them. So in the Default of the control would be something like
If(
YourFormName.Mode=FormMode.New,
YourInspectionValue,
Parent.Default
)
Happy to assist further - just paste your code in Text.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks for the fast reply!
The reason why I want/have to use the joining table is that the inspection points can be modified, so they're not fixed. Thereby I want to store the results per inspection, so I have to have a copy of the records containing the results.
You need a Lookup inside your Filter to refer "through" the tables (messy). Please paste the code you have done so far as Text and also what are all the field names?
Hi,
Sorry for the late reply, I'm not able to work on this every day. The thing is that I don't really have any code yet, as I'm not sure what the best way to do this is.
I want to register a daily inspection via Powerapps into an SQL database.
The daily inspection consists out of N inspection points, registered in the Inspection table in my SQL
Every daily inspection is a work order in my Workorder table
So my challenge is how to cover every inspection point from the inspection table every time I create a new work order. I thought the best way to do this was a third table, containing the relation between the two, my WoInsp table. This WoInsp table contains a column for the InspectionId, the WorkOrderId and the value that is registered.
So I have a work order screen, containing basic work order information from the Workorder table and a second galery with the Inspection Points fromt he Inspection table. The challenge is that I want to open an inspection point and write the entered value to my WoInsp table, including the WorkorderId and InspectionId.
I'm now one step further. I just thought that I only need 3 columns in my WoInsp table:
- WoInspID (Id of the current row, primary key)
- WoInspInspId (Id of the inspection point)
- WoInspWoId) (Id of the work order)
The WoInspId and WoInspInspId columns are "not null", so I tried first to add only the InspId:
Patch('[dbo].[WoInsp]';Defaults('[dbo].[WoInsp]');{WoInspInspId: InspId})
This results into an error after saving: "Could not find the giver record. Server reply [dbo].[WoInsp] failed: Resource not found" (translated from Dutch).
Below the code I used to create the table:
CREATE TABLE WoInsp (
WoInspId int identity(1,1) NOT NULL,
WoInspInspId int NOT NULL,
WoInspWoId int,
PRIMARY KEY (WoInspId)
);
Firstly this code
Patch(
'[dbo].[WoInsp]';
Defaults('[dbo].[WoInsp]');
{WoInspInspId: InspId}
)
certainly should create a new record in your table providing WoInpInspId in the table and InspID in your code are both Integers. I am not any SQL authority (I have used it in the past, but am a SharePoint user in Power Apps), but have you had a look at your table and seen if you can enter things directly?
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I'm not sure what happened over night, but now I am able to create the record. I think my SQL just had to refresh something (although I did press refresh on the powerapps database).
so far so good, thanks
User | Count |
---|---|
250 | |
102 | |
94 | |
47 | |
37 |