How I can do this in Crystal Reports? - if-statement

I have to create a formula to limit the registrtions in my report.
it is something like this:
If {sp_rep_comite.vnumero_cte}< '00' then
{sp_rep_comite.vnumero_cte}
Else
If {sp_rep_comite.vnumero_cte} > '00' then
{sp_rep_comite.vnumero_cte}
Else
If {sp_rep_comite.vnumero_cte} > '04'then
""
Else
if {sp_rep_comite.vnumero_cte}< '04' then {sp_rep_comite.vnumero_cte}
but it does not work.

Related

Datediff in an If statement

For some reason I can't figure out why the code below doesn't seem to work it will only display one or the other and wont switch. I am also wanting it do make the text box blank if neither of them are true. Any help would be so great.
Private Sub txtDental2813NextDue_AfterUpdate()
If DateDiff("d", [Dental 2813 Next Due], Now() >= 1) Then
Me.Text350 = "Due"
Else
Me.Text350 = ""
If DateDiff("d", [Dental 2813 Next Due], Now() >= 90) Then
Me.Text350 = "Overdue"
Else
Me.Text350 = ""
End If
End If
End Sub

Oracle APEX 5.0: add items values to dynamic URL

I have table containing data in columns apex_page, apex_to_item, apex_with_values like this:
apex_to_page: 6010
apex_to_item: P6010_XSRCS_ID,P6010_XSVER_ID
apex_with_values: XSRCS_ID,ID
During rendering of the page I want to parse this values (URL destination, list of items to set, list of values from current page) and create URLs based on it. For example: f?p=112:6010:4314006485638::NO::P6010_XSRCS_ID,P6010_XSVER_ID:100,200&cs=3LNhUQHJiAOOaiw3C_z3bHGtc4Us0LZV-D7ZMQhG0Z3EzCLeJpT8f--YA7SFOoD4xQD2C45qrv2PVxvwBY39qBA
I.e. I want to take current values of XSRCS_ID,ID items of current page (100,200) and insert it into URL. When there is only one value to pass I have solution:
SELECT name label,
APEX_UTIL.PREPARE_URL(p_url => 'f?p=' || NV('APP_ID') || ':' || apex_page || ':' || NV('APP_SESSION') || '::NO::' || apex_to_items || ':' || NV('P' || :APP_PAGE_ID || '_' || apex_with_values), p_checksum_type => 'SESSION') apex_url
FROM ...
When there are more that one item to pass I've tried something like this:
SELECT name label,
APEX_UTIL.PREPARE_URL(p_url => 'f?p=' || NV('APP_ID') || ':' || apex_page || ':' || NV('APP_SESSION') || '::NO::' || apex_to_items || ':' || regexp_replace(apex_with_values, '([^,]+)', NV('P' || :APP_PAGE_ID || '_\1')), p_checksum_type => 'SESSION') apex_url
...
FROM ...
and it isn't worked.
Is there a way to extract values from page and insert it into URL?
You need to add coma separated values. First you need to combine all the Keys together (coma separated) and then the values also coma separated.
Here is an example
l_url := APEX_UTIL.PREPARE_URL(
p_url => 'f?p=' || l_app || ':'||apex_application.g_x01||':'||l_session||'::NO::'
||l_item_item1|| ','||l_item_item2||
','||l_item_item3||','||l_item_item4||':'
||apex_application.g_x02|| ','||apex_application.g_x03||','||
apex_application.g_x04||','|| apex_application.g_x05,
p_checksum_type => 'SESSION');
htp.p(l_url);

Using an IF statement to concatenate a string and a number

I'm working with a LaTeX screenplay documentclass document that has a slide counter in a newcommand that I wrote"
\newcommand{\slide}[1]{
\stepcounter{slidecounter}
\newpage
\begin{center}
\underline{\textbf{Slide \arabic{slidecounter}}}
\end{center}
\rule{6in}{0.01in}
\par
#1
}
This works perfectly for my purposes. But now I'd like to modify it so that it is something like:
\newcommand{\slide}[1]{
\stepcounter{slidecounter}
\newpage
\begin{center}
\underline{\textbf{Slide \arabic{slidecounter}}}
\end{center}
\rule{6in}{0.01in}
%%
If slidecounter < 10 then "00" + slidecounter = ctr
Else if slidecounter >= 10 & slidecounter < 100 then ctr = "0" + slidecounter
Else ctr = slidecounter
%%
\par\bigskip
\begin{center}
\fbox{\includegraphics[scale=0.50]{"Page_"ctr.png}}
\end{center}
\par
#1
}
The "Page_###.png" is a numbering scheme for identifying image files such as Page_010.png, Page_099.png, Page_109.png.
How do I write the If clause to accomplish this?
Thanks,
Walt Paczkowski
If you add
\newcommand{\threedigits}[1]{%
\ifnum\value{#1}<100 0\fi
\ifnum\value{#1}<10 0\fi
\arabic{#1}%
}
to your preamble, you can use
\includegraphics[..]{Page_\threedigits{slidecounter}.png}
to have a 3-digit representation for you slidecounter counter.

Regex to remove all greater than and less than but not if "br" are between

I want to remove all greater than and less than symbols. I do NOT want to remove the contents between those symbols and I do NOT want to remove br tags. Is there any way to do this? Keep in mind I have no idea how to use Regex.
This is what I have so far:
/[<>](?!b)/g
If I use that regex on this:
< >"' <<< < < <br> <aaa > >
Then I get this:
"' <br aaa
But I want this:
"' <br> aaa
Please help! (ノ´ロ`)ノ
EDIT: (To show the answer and use)
Function to print the contents of php "objects" for troubleshooting, etc.
function myPrint($myPrint, $returnAsString = FALSE){
if($myPrint === FALSE){ $myPrint = "FALSE"; }
if($myPrint === TRUE){ $myPrint = "TRUE"; }
if($returnAsString === TRUE){
return preg_replace(array("/\s/", "/<(?!br>)/", "/(?<!<br)>/"), array(" ","<",">"), nl2br(print_r($myPrint, true),false));
}
else{
echo preg_replace(array("/\s/", "/<(?!br>)/", "/(?<!<br)>/"), array(" ","<",">"), nl2br(print_r($myPrint, true),false))."<br>";
return;
}
}
Typically it's easily done with a couple of assertions.
<(?!br>)|(?<!<br)>
Expanded
<
(?! br> )
|
(?<! <br )
>

if or statement unexpected token

I've attempting to write an in or statement, and in all honesty have never used one before. I'm trying to use the following snippet of code:
$(document).ready(function () {
if(window.location.href.indexOf("invt") > -1 || window.location.href.indexOf("shopcart") > -1)) { // if URL contains invt or shopcart
$('#carriage-promo').prop('id','newid');
}
});
But it keeps returning errors no matter what I try!
Any suggestions?
( ) are unbalanced.
if(window.location.href.indexOf("invt") > -1 ||
window.location.href.indexOf("shopcart") > -1)
I removed the last ) at the end of your if statement
if(window.location.href.indexOf("invt") > -1 || window.location.href.indexOf("shopcart") > -1))
You have one too many closing brackets )
Try:
if(window.location.href.indexOf("invt") > -1 || window.location.href.indexOf("shopcart") > -1)