COGNOS REPORT assign dynamically default prompt value with Java Script - javascript

I am working with Cognos 11. I have a list of parameters for a list of users. My problem is that I can't set a default value because each client has different data.
For example: I have a client that has data until NOV-2019 and another FEB-2020.
I need for the report to take the last date available and show the report associated to that date.
I was looking at documentation and it is supposed to be with JavaScript/HTML. I don't know JavaScript/Html.
I have a parameter p_period that needs to be loaded with the last date available and a prompt combo box.
Can anyone help me please

Related

Turn Dynamics 365 address field into dropdown list

I’m new to both Dynamics 365 and javascript.
By now users when have to fill an address form write values manually, therefore for the same region we have values like: Lombardia, LOMABARDIA, lomb, Lombadia, etc...
I can't create custom fields because address fields are grouped into composite field and are used for outlook sync.
So i think the right way is create a javascript mask that paste the choosen value in the free text address field, but here is my biggest problem, how to set that mask...
Questions:
Is this the best practice? if not what is?
I am able to create javascript's list and get/set value from crm, but i dont know how to build it over a free text field, any help?
You should consider address resolution API, you will then be able to split the selected address that will be in a standard format. Try to check out Experian or even the google API, you can build a custom web resource, hook up the JS that will do address resolution for you, on selection split the values in the composite fields.
Rather than "build it over a free text field", which is unsupported, you can build your own custom HTML web resource and add that to the form.
As this document points out, you will need to use parent.Xrm.Page to reference the form - e.g.:
var customerRef = parent.Xrm.Page.getAttribute('customerid').getValue();
This forum indicates that although Xrm.Page is deprecated in v9, it is still valid (for now) to use parent.Xrm.Page from a custom web resource.
Also, please note that to enable accessing the form you should include
<script type="text/javascript" src="../ClientGlobalContext.js.aspx"></script>
in your custom web resource.

How to pass parameter from D365 portal to workflow/action?

I am using the Integrated Portals coming with D365. I have an entity list and I've put a date-picker and a submit button in the page. I want to update the records inside the entity list with the date that the users selects from the date picker.
My problem is that I do not know how to pass the date picker value from the portal to the workflow (or somebody suggested using Actions).

Get the users local time accurately

I am working on a project which primarily uses javascript, css, html5. I need to get the local time accurately no mater where the user is located to allow user to access a module on a particular date. Assume 1 September.
How do i get the users local time accurately?
Options:
1: Use JavaScript to get the users local time and use it.
problem: The user can manually change the date time settings of his system to change the date and access the module prematurely.
2: Use server date time to enable a module on a particular date.
problem: The server could be located anywhere eg: in U.S. and people in Australia will not be able to access the module unless the date in U.S is 1 September.
Is there any other option.
Is using client IP address a option?
well, the user's time/date info is not included in the http request header, so php will not automatically have that information. You can, as you said, use javascript to get the user's time similar to what was posted here: Determine a User's Timezone -- this is with pure javascript, if you use jquery or something similar to it, you can do it very easily.
if these are registered users however, you can allow them to set a timezone in their profile/settings, and then just use THAT setting, so even if they are traveling, they will always be set to the "home" timezone.
does that help?
First of all you should always assume user may fake any data calculated on his side. Therfore using server time is more reliable.
Using IP is an option - you can find services and databases that allow you to resolve IP to country its located in. Example: http://php.net/manual/en/book.geoip.php
Lastly - why do you want efectively differend release date for various countries? They can always use someone in other country to access module in their name.
If the user gives permission, and is using a supported browser, etc, you can get their location using navigator.geolocation.getCurrentPosition().
See developer.mozilla.org/en-US/docs/Web/API/Geolocation.getCurrentPosition for parameters and more info.
You can then use a service such as provided by geonames.org. Eg, http://api.geonames.org/timezone?lat=47.01&lng=10.2&username=demo . This returns the time at the given coords.
Update as per first comment: Of course you can never trust any data coming in from outside. But you can do things to raise levels of confidence. This wasn't meant to be a full stand-alone solution.

How can I make a search box to search in a local database?

I'm playing around with Apache Cordova and I want to implement a search box that can search in a list or something similar (local database?). I want it to be local so that the app does not require an internet connection to search.
The way I want it to be set up is that it need to be able to search for both the name of the item and a number.
Example 1:
A user searches for: "Honda". He will then be sent to a page where information about "Honda" will be diplayed.
Example 2:
A user searches for the id: "1337". He will then be sent to the page containing information about "Honda".
So "Honda = 1337" and "1337 = Honda" if you guys understand?
The question:
I'm wondering what solution would suite my needs for this project?
or there any frameworks out there for this?
Thanks in advance!
It depends on what you want to have the search box and submit to be like.
One way is to use this really great tool http://ivaynberg.github.io/select2/ it can load data from database (using either ajax or load all of your data and only filter them) and shows them in selectbox. You can have submit button or something like that next to your selectbox.
Other way might be to use http://www.datatables.net/ it has search box, which can load data to table using ajax where you can have additional information and submit button for sending user to specific page.
There is plenty of other tools for this kind of problem, I used these two and I can say

Use Python to return data from a Webpage's Ajax call

I'm writing a program in Python that needs to use a site's advanced search options. Specifically, the search page is the NVC advanced search page . I know the names of the projects and versions I need to search for, so ideally the program would select the project names and versions numbers from the dropdown lists, then return the results page(s).
I'm totally unfamiliar with HTML and Javascript, and I'm fairly new to Python, so I don't know if there's a way to 'click' these dropdown menus via Python, then return the results. The fact that the Javascript makes an Ajax call further complicates the situation, since I can't just load the page's source and parse out the list of project names and version.
Can anyone with some Python/Javascript/Ajax experience send me in the right direction?
An example use of this program would be that I start out with the project "glibc' and its version number '2.3.6' The program would make sure that this combination is listed at all (which isn't guaranteed), then return the results page (which has about 13 results).
The Mechanize Python library is perfect for form automation. There is an example of how to edit and submit forms on the examples page.
If a human user is using that search page, they click on one of the product links, which then load the list of products from another page, e.g.:
http://web.nvd.nist.gov/view/vuln/cpe/cpe-chooser?index=0&component=Vendor
This page is unfortunately not using JSON, so they have some custom javascript parsing for the response. The data from this response is then displayed as a drop-down for the user. When the user selects a product, the browser selects the correct value, so that when the form is submitted, it will be part of the query. e.g.:
http://web.nvd.nist.gov/view/vuln/search-results?adv_search=true&cves=on&cpe_vendor=cpe%3A%2F%3Aa-a-s_application_access_server
In this, cpe_vendor=cpe%3A%2F%3Aa-a-s_application_access_server is the important part. The part before the = sign is the field name, the part after is the selected value (which originally came from the ajax request). The funny %3A bits are URL-encoding.
So you don't actually need to interact with the page, since you know the names of the vendors and products for which you want to search; you just need to look up the field name (cpe_vendor for vendors) and the value for the specific products/vendors (cpe:/:a-a-s_application_access_server for my example above), then do a request to the normal search URL.
The advanced search options page sends the options via GET to the results page, giving you the URL (linebreaks mine to make it clearer):
http://web.nvd.nist.gov/view/vuln/search-results?
adv_search=true&
cves=on&
cve_id=&
query=&
cwe_id=&
cpe_vendor=cpe%3A%2F%3Aian_bezanson&
cpe_product=cpe%3A%2Fa%3Aian_bezanson%3Adropbox&
cpe_version=cpe%3A%2Fa%3Aian_bezanson%3Adropbox%3A0.0.3_beta&
pub_date_start_month=0&
pub_date_start_year=2005&
pub_date_end_month=2&
pub_date_end_year=2009&
mod_date_start_month=2&
mod_date_start_year=2007&
mod_date_end_month=9&
mod_date_end_year=2009&
cvss_sev_base=&cvss_av=&
cvss_ac=&
cvss_au=&
cvss_c=&
cvss_i=&
cvss_a=
It would then take a bit of sleuthing to figure out what bit of the url is what information from the form but that should let you then just scrape the results page.

Categories

Resources