Powerapps - get stuck with UpdateContext - datetime

I am trying to build a PowerApp to log setup times of our machines by our fitters.
This is what my app looks like:
There are buttons named "Uhrzeit". Pressing these will write the current date and time into the Date/Time fields. I am using the following code:
UpdateContext({Total8:(Text( Now(); "[$-de-DE]dd/mm/yyyy hh:mm:ss" ))})
The Date/Time field is named Total8.
The code is working well but after saving the form and opening a new record the old data is still available in the fields. By clicking on the button "Zeiten zurücksetzen" I can "delete" the old data.
UpdateContext({Total8:""})
Problem: When I open one of the older records the old data is not available in the form. There is only the value of the last record. In the Common Data Service where my records are saved the values are correct.
As an example, I am saving this record:
When I open a new record, the values of the record 1 are still available. This should not be the case if my app worked properly.
For your Information:
If I enter the date/time without tapping the button, saving the record and opening a new record I don't have the problem. I think the "UpdateContext" code is not the code I should use here.
Can anyone help me solve the problem?

I don't think there's a problem with using the contexts in this way -- but remember that a context is just a variable. It isn't automatically linked to a datasource in any special way - so if you set it equal to Now(), it's going to keep that value until you do something different.
When you view an old record, you need to get the data from CDS and update your contexts to match the CDS data. Does this make sense?

Yeah thats my problem.
I want the variable to be linked to a datasource. Or is it possible to write the date/time into the fields without using a context variable?

Related

D365FO Tile count on workspace doesn't work

Situation is next one:
I created several tiles. Every tile need to show count of records.
Tile "Expired Active Contracts" always shows zero.
There is created simple query with data source table Contract. Ranges are added (ContractStatus; Value: 2) and (ValidTo; Value: (LessThanDate(0)) )
When it's clicked on tile, it opens valid form with valid record, where contracts status is active (2) and ValidTo are any date before today's date, but count doesn't working.
Tried to recreate, tried several things but definitely nothing. ValidTo field is date field.
Some time ago I had a mistake very similar to yours in my dev environment, this steps help me to fix the error.
1 - Clear Usages Data.
2 - SysAdmin/Setup/Data cache/Tile data cache configuration. Select
the tiles which are running into this issue and then delete the
selected tiles.
3- In VS rebuilt and Synchronized the Solution.
4 - Finally refresh the Application browser.
Another thing is that a while ago there was a problem for tiles refresh
Issue 243278 Workspace tile does not update correctly when reusing the
same name
https://fix.lcs.dynamics.com/Issue/Details?bugId=243278&dbType=3&qc=68b6dc6804c9cea218daa102968c7acfcdfe6a990e80e0b5ec66b920a680fceb
I hope you find it useful

Get Requsition ID based on PO

In FSCM I am looking to modify the Search view on Add/Update PO page (Main Menu--> Purchasing--> Purchase Orders--> Add/Update POs) to display the Requisition ID associated with the PO in the search results page. The only table I have found that has both PO_ID and REQ_ID is PS_PO_LINE_DISTRIB however unless I use a SELECT DISTINCT clause I will get multiple PO_ID rows when there are more than 1 line on a PO.
Within Purchase Order Inquiry you can see the related Requisition ID's related to a PO by clicking on Document Status link inside the Purchase Order inquiry details page.
I started looking at the PeopleCode within the the Purchase Order Inquiry to see how they are linking the PO to a Requisition and it appears to use work tables with related PeopleCode function libraries, but I wasn't able to figure our how they get linked. I am hoping someone else may know the answer to this. Thank you.
I'm on an old version of PeopleSoft (SCM 8.80, Tools 8.51), so your mileage may vary. I'm assuming you're familiar with App Designer. If not, comment below and I'll add some details about what I'm clicking on.
Find the name of the Add/Update PO component.
Open the PURCHASE_ORDER component in App Designer. Now let's find the name of the search record. Note that there is a different record for the Add Search Record, so if you want to change that too, do all of this for that record as well.
Open the PO_SRCH record, and add the REQ_ID field to it. Make sure you mark the field as a key. You should consider saving your modified PO_SRCH under a new name in case you want to be able to revert to vanilla PeopleSoft. If you do, change the Search Record in the component to your new record name.
We can see that PO_SRCH is a view. So let's modify the view to pull in REQ_ID from PO_LINE_DISTRIB. As you mentioned above, there doesn't appear to be another table with both PO_ID and REQ_ID, so you'll have to do a SELECT DISTINCT.
We should do a LEFT OUTER JOIN instead of a standard join because if you do a standard join and you enter a purchase order with no lines and save it, then you'll never be able to retrieve that purchase order in this window. Since REQ_ID is a key field, we can't have a null, so we have to do the CASE.
One odd thing that I ran into here was building the view now gave me an error about selecting fewer columns in the SQL than I had in my record definition. I solved it by modifying the view for SQL Server. I've never had to do that before and I don't know why I had to do it for this specific record. But anyway, I entered the same SQL under the record's "Microsoft SQL Server" definition.
In the properties of PO_SRCH, we can see that it has a related language record. If you're only using one language, you can probably get away without changing this, but I'll do it for completeness. Open PO_SRCHLN. Now add REQ_ID to it (mark it as a key field like you did above), and save it as PO_SRCHLN2 (I'm saving it under a new name so I don't break anything else that may be using PO_SRCHLN).
Edit the SQL the same was as you did above. Note: I didn't have to also change the Microsoft SQL Server definition like I did above. I have no idea why.
Now build PO_SRCHLN2.
Go back to PO_SRCH and change its related language record to PO_SRCHLN2.
Now build PO_SRCH.
Hopefully you didn't get any errors and your search page has the requisition ID in it now. My system doesn't use requisitions so they're all blank in the example below, but the new field is there.

Extracting table from a webpage in automation anywhere

Is there a way to extract a table from a web page in Automation Anywhere after taking certain steps using web recorder. The table does not appear directly, it appears after clicking few controls after launching the URL.
The table that I want to extract is coming after loggin in to the website and filtering using a control for search criteria.
I used web recorder to login and putting the desired search criteria in a text field and I want to extract the table now. When I use web recorder, it launches the URL again and takes me back to the login page which I dont want. I want the bot to stay on the page. Pls help.
Also, what is the significance of session name of an extracted table?
If you clicked on Advanced View, you will find at Step 5 : to run this command using an existing IE window. Try to write the URL of the page with the table and not the one of the login page.
The extracted table is to be used using variable $Table Column(Index)$ with index being the column number or column name
you can export directly using object cloning and in the selection criteria export to csv file. But we need to click on html inner text also in search criteria
An old question, but my experience has been the Extract Data/Table commands are rather poor. Not only do they only work in IE, you cannot call them as commands, they have to be called via a web recording.
Instead, I've found it much more useful to object clone the initial element, grab the DOMXPath, and variablize that. Then throw it into a loop while command and set the condition on finding at least one element (of the elements for the table you are trying to build). You can grab all sorts of useful info in the object clone command and then right that to a variable/table.
For example
//div[#id='updatable-standings']/div[1]/div[1]/div[2]/div[1]/table[1]/tbody[1]/tr[3]/td[2]/div[1]/span[2]
//div[#id='updatable-standings']/div[1]/div[1]/div[2]/div[1]/table[1]/tbody[1]/tr[4]/td[2]/div[1]/span[2]
I can create a incremental variable for {tr[3]} and call it $vTeamLoop$ and change my DOMXPath value in the Object Clone to be
//div[#id='updatable-standings']/div[1]/div[1]/div[2]/div[1]/table[1]/tbody[1]/tr[$vTeamLoop$]/td[2]/div[1]/span[2]
Ultimately, it is more steps than the Data/Table Extract command, but it is far less limited in scope.
Hope that helps.
enter code here

parameters in subform pulled from main form

I have done this a couple years ago but can't seem to remember how; I am working with access 2010 and the macro builder as opposed to VBA ( I don't do this enough for the coding).
Anyways what I have is a main form that has a subform that displays as a datasheet. This subform data source is a query that asks for three values which are applied as filters using just a where statement.
The query SQL is a select statement, followed by from and then a where statement and no parameter statement.
What I am trying to do is get the subform when it opens to pull the parameters from the main form record it is under.
I know this is possible because I have done this a couple years ago but don't have that database anymore. I have gone through all the books I have and still can't seem to find a combination that works.
Any suggestions or help with what I am missing?
****Update******
The set value isn't working... What I have is a form SQ_Ticket that has fields Site Number, Date Submitted, and End Date. I then I have a sub form that is based on a parameter query, it has a different number of fields then then the ticket query so a Union is too much of a hassle. But the fields in the sub form that would relate to the main form are Site Number and create date.
What I am trying to do is I have the main form (SQ_Ticket) with a sub form (SQ_Alarm_Parameter subform) and the form is a datasheet. When I click to expand the subdatasheet I want the Parameter query to pull the Site Number from the main form and use it to match to the site number in the subform and the pull the Date Submitted and End Date and use it as the start and end in a between statement for the create date in the sub form.
Basically I want to use find all records in the sub form (SQ_ALarm_Parameter subform) that have the same Site Number as the record in SQ_Ticket and that are Created between the Date Submitted and End Date of the Record in SQ_Ticket.
I seem to recall needing to pull the specific data from the main form and then using it as a temp value in the subform, but again can't remember how do to do that.
I know I am missing something obvious since I know I have done this before, but I didn't think to keep a copy of that work and it was quite a while ago. So I really appreciate the help
Firstly, I think taking a few minutes to do the VBA would be valuable and easier to work with. However with the macro method you can just use the Set Value submacro. This won't show up by default so you will need to select "Show All Actions" on your ribbon at the top of Access.
The Macro:
This will allow you to set the RecordSource for one form based off of value of a textbox on another form. You just need to adjust now work with your fields and parameters.

Auto-Incrementation in InfoPath 2010 Form

I have a form in which I am attaching a workflow to. The form has a number that will be auto-generated. For example the first number will be 1, the next time the form is opened the number should be 2, so on and so forth. The issue I am having is: in the Default Value under the Text Box Properties I have the Value as: count(mynumber QuoteNumber) +1. When the form is generated the first and only number is 2 the number begins at 2 and never increases. Can someone help me with this or explain what I may be doing wrong? Thank You. I'm not using visual studio.
Rachel: I have fought with this problem since InfoPath 2007. Here is how I do it.
Since you say you are attaching a workflow, I assume you are using the from in SharePoint.
1 - create your form library in SharePoint
2 - use InfoPath to design the form. When you publish the form to SP, make sure you promote AT LEAST the ID field you want to auto-inc. (I usually promote every field in my forms, 'cause I like to use them like SP lists.)
3 - In SP, create one new form and manually set the ID field to the starting number for your form series.
4 - return to InfoPath designer and re-open your form template.
5 - create a new data source to receive data from your SP form library and specify your form library as the source, and the ID field as a data element. Name the data source something like “ID Lookup”.
6 - open the properties of the field you want to auto-inc on your form and, in the default value box, select function, then choose the MAX function.
And add “+1” after the function to increment by 1.
Now, double-click in the field are of the Max function. You will see a dialog showing your form fields. Notice the drop-down at the top of the dialog – here you can choose the data source (notice I named mine “sales Contracts” in this example). If you select the data source you created in step 5, you will see a dialog showing you a couple of data branches.
Expand the ‘dataFields’ branch until you see the field you want to auto-inc. Click on this.
Your formula dialog will look something like:
max(ID_X0020) + 1
With your field name instead of the 'ID' in the Max function – the function will now return the Maximum value of the field IN THE FORM LIBRARY, plus 1.
Save the form in InfoPath and try previewing it. You will probably get a security warning – your InfoPath form is grabbing data from your SharePoint library on the fly. You may even get asked to re-enter your password (I usually do). When the new, blank form is displayed in InfoPath preview, you should see you ID field filled in with a value one greater that the number in that field of your SP library.
There is one huge Gothca with this method - if users re-open a completed form to edit it, the formula will probably try to replace the ID number. If your users don't edit the forms after they are submitted, the this will work for you.
Hope this makes sense.
You aren't doing anything wrong - you just have to change how you think about "forms" a bit. Remember a form is just like a word document template. Suppose you save a word document on your hard drive with a blank spot to fill in your name. Later you open the template, type your name, and save a copy as V1.doc. When you go back and open the template again - your name is not there because it was saved in V1.doc. Everytime you open the template you start again from scratch.
Infopath forms that you design and that the user fills out are templates (.xsn files). When the user fills it out and saves it they are really saving a copy which is only data (.xml files). The .xsn template doesn't change when users interact with it.
So to answer your question - there is no way directly in InfoPath to cleanly keep track of an auto incrementing ID. You will need to tap into some code (webservice, sharepoint, etc) to do that. You could also consider making the ID a GUID (which infopath does support) but it won't be auto incrementing and it won't look "clean" if it has to be displayed/used by real people.

Resources