Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports

Status
Not open for further replies.

hanreb

Technical User
Jan 23, 2008
90
US
Hi,

I am creating reports in livelink.
I have two input parameters named, from date and to date.

Is there a way to write code to check if to date is (greater than) > from date.
Can we achive the above either in Web reports or Live reports.

Looking forward for a valuable input.

Thank You,
sunu
 
Hi,

I assume you would like to detect if date1 < date2.

In that context, may be there are several ways to check this, e.g:

1. if your rdbms is Oracle, you can try this:
select Name from DTree where CreateDate between
case when date1 > date2 then date2 else date1 end and
case when date1 < date2 then date2 else date1 end

2. this should work in any case:
select Name from DTree where
((CreateDate between date1 and date2) or
(CreateDate between date2 and date1))

Regards,

Olivier
 
Hi Olivier,

I am not sure if I explained the problem correctly.

I have defined 2 input parameters, which are of type date for my liverport.
If user selects a to date which is lesser than the from date
I want to give the user a message saying that "To Date cannot be lesser than from Date, please select the correct values".

Is this possibel to do in live reports ??
If so, where do I write the code ??

can we check like
if param2 < param1

alert "error........."


 
although I have no examples I think you can do this with web reports.web reports does execute javascript and you will probably be able to do your alerting that way.So design your livereport as one normally does and code the extra stuff in javascript.If the test succeeds then call the dataid of the livereport that is how you call a LR form a WR isn't it .I will see if I can throw a simple example here.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Hi,

you wil have to write an html page (e.g: a customview) that calls your report through a url or by submitting a form with the necessary parameters).

You can pick up the date fields, as well as the javascript code aimed to manipulate these fields, from the input page of your LiveReport.

When the user click the link or the button on your page, a javascript code executes and checks the inputs before calling the report.

Hope that helps,

Olivier
 
Just to illustrate what I said (note if you intend to modify the select pop-up, you will have to modify some counters in the inputLabel#_update js code accordingly),

<html>
<head>
<script>
function execReport(objid, param1, param2, param3, param4, param5)
{
if ('undefined' != typeof objid && null != objid)
{
var sURL = '?func=ll';
sURL = sURL + '&objId=' + objid;
sURL = sURL + '&objAction=runReport';
if ('undefined' != typeof param1 && null != param1) {sURL = sURL + '&inputLabel1=' + param1;}
if ('undefined' != typeof param2 && null != param2) {sURL = sURL + '&inputLabel2=' + param2;}
if ('undefined' != typeof param3 && null != param3) {sURL = sURL + '&inputLabel3=' + param3;}
if ('undefined' != typeof param5 && null != param5) {sURL = sURL + '&inputLabel4=' + param5;}
if ('undefined' != typeof param5 && null != param5) {sURL = sURL + '&inputLabel5=' + param5;}
sURL = sURL + '&nexturl=' + escape(window.location.href);
window.location.href = sURL;
}
}

// Other js code picked up from
function inputLabel1_update( changedField, form, newDate )
{
// ...
}
</script>
</head>
<body>
<form name="yourformname">

<SELECT class="searchBut" ID="inputLabel1_day" NAME="inputLabel1_day" onChange="inputLabel1_update(this, this.form, null)">
<!-- the rest of the select and option fields you have copied from the input page of your LiveReport -->

<!-- finally, a link or a button -->
<a href="javascript:execReport('123456', document.forms.yourformname.parameter1.value, document.forms.yourformname.parameter2.value)">Click here</a>
</form>
</body>
</html>

Regards,

Olivier
 
Thank you Olivier.
I started writing java script in the edit report view section of web reports.

Let me see if I am successful there before I attempt this one.

Thank You,
Sunu
 
Hi appnair,

I am trying to use javascript as was posted in your previous reply.

I am having a problem with my java script, diplaying a message to the user using alert.

Below is the simple javascript function , which I wrote in the header section of my edit report view area(in web reports),


[LL_WEBREPORT_STARTSCRIPT NAME:myFunc /] function String anyName(Dynamic c) String s = 'Testing' alert ('done') return s end [LL_WEBREPORT_ENDSCRIPT /]

I am calling this function from the row section using the following statement,
[LL_WEBREPORT_CALL NAME:myFunc /]

I do not get any error, but I don't see the alert message as a popup window.

Could you be able to tell me where I am going wrong ??
I have enabled scripting.

Thank You,
Sunu
 
Hi,

if you read carefully the on-line help, you will see that the [LL_WEBREPORT_CALL NAME:myFunc /] tag is executed by the parser and enables you to insert strings in the html code. So you will not see the alert() box but only the s string in the generated html page. More, alert() might cause an error, resulting in an uncomplete html page, as the code you can write in [LL_WEBREPORT_STARTSCRIPT NAME:myFunc /] doesn't look like javascript.

Regards,

Olivier
 
Hi,

I have the piece working as below,

[LL_WEBREPORT_IF "[LL_REPTAG_&inputLabel2 /]" < "[LL_REPTAG_&inputLabel1 /]" /]
<font size=2 face="Helvetica" color=red><center>To Date cannot be lesser than from date</center></font>

[LL_WEBREPORT_ENDIF /]


I still would like to know if this message that I give to the user in html page can be displayed to the user in some sort of message box.

I mean the below message

<font size=2 face="Helvetica" color=red><center>To Date cannot be lesser than from date</center></font>

I appreciate your reply.

Thank You,
Sunu
 
Indeed.

You may add: please click back and select other dates. However, I don't think a msg box you can insert between <script> within [LL_WEBREPORT_IF... adds any value.

Regards,

Olivier
 
Hi Olivier,

This was a user requirement.
They wanted to see this message as a pop up box /aler6t box/ message box.
I wanted to find out if this is achievable or not ?

Thank You,
sunu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top