Page 1 of 2
Which object to represent historical data ?
Posted: Mon Jan 02, 2023 1:14 am
by yvesf
Hello,
I have an application with 2 forms : invoice and customer.
When I create my invoice I have a lookup field customer in which I retrieve the name, address, email. I would be interested to retrieve, at the moment I choose the customer on the edit form the list of all previous invoices for this customer. Is it possible to do that and how can you do that ? Display object is able to present only 1 record not all historical invoices for this customer.
If someone could help here. Many thx,
Yves
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 5:53 am
by kev1n
Use a Run object (iFrame)
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 5:26 pm
by yvesf
How can I disable the add button in the related iFrame ? If I use iFrame to view the historical data, I need to be able to remove the button that allows me to change the historical data. I have tried nuHideHolders(0,1) which is working everywhere and therefore I cannot even add a new record.
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 5:40 pm
by gerese
Try this in JS for different situations:
Code: Select all
$('.nuActionButton').hide();
$('#nuSearchField').hide();
$('#nuActionHolder').hide();
$('#nuBreadcrumbHolder').hide();
$('#nuTabHolder').hide();
$('#nuBrowseFooter').hide();
$('#nuAddButton').remove();
$('#nuSearchButton').remove();
$('#nuPrintButton').remove();
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 8:57 pm
by yvesf
Thanks, it helps except the fact that if I hide for example the add button, I can't do that from the iframe but also everywhere. The browse form behavior is defined once for the form and hiding elements in a form will impact everywhere where this form is used. Consequently, I will not able to add new records for this form.
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 9:17 pm
by gerese
In the IFrame you have a form whose buttons can be hidden from the editform separately from the main form, maybe this video can help you
https://www.youtube.com/watch?v=Inr_HQyfE_Q
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 9:22 pm
by kev1n
Use the function nuIsIframe() to detect if the form is within an iframe.
Re: Which object to represent historical data ?
Posted: Mon Jan 02, 2023 11:00 pm
by yvesf
nuIsIframe() is not documented . Could you please provide me an example on how to use and where ?
Many thanks,
Yves
Re: Which object to represent historical data ?
Posted: Tue Jan 03, 2023 8:39 am
by kev1n
Looking at the source code, it returns a boolean (true, false).
Long explanation, for those who want to learn more:
This function checks whether the current window is an iframe or not. It does this by checking if the parent window has a different nuDocumentID than the current window, and if the parent window has a defined nuDocumentID value.
If the parent window has a different nuDocumentID value and it is defined, then the current window must be an iframe. In this case, the function will return true. Otherwise, if the parent window's nuDocumentID is the same as the current window's nuDocumentID or if the parent window's nuDocumentID is not defined, then the current window is not an iframe and the function will return false.
The parent.window object refers to the parent window of the current window, and window refers to the current window. nuDocumentID is a variable that is used to store a unique identifier for the document.
Code: Select all
function nuIsIframe() {
return parent.window.nuDocumentID != window.nuDocumentID && parent.window.nuDocumentID !== undefined;
}
Usage: Code in the form's (iFrame) custom code:
Code: Select all
if (nuIsIframe()) {
// code here...
}
Re: Which object to represent historical data ?
Posted: Thu Jan 05, 2023 1:16 am
by yvesf
Thanks for this explanation. My browse form appears in 2 iFrame only : in first one I need the buttons to add, in the historical one I need to avoid any interaction with the list. I have also to disable the double click to open a record. How can I do that ? how can I identify the parent form of an iFrame ?
Many thanks for your reply,
Yves