How should I structure this AMPscript to display 1 value if empty and other if not?
%%[
/*Set Dynamic Image URL for Hours Field */
IF not empty (#Business_Hours__c ) THEN
SET #HoursImgURL = "URL1"
ELSE
SET #HoursImgURL = "URL2"
ENDIF
]%%
or should I use :
IF Business_Hours__c == NULL THEN?
The IF statement above looks fine in that it will set #HoursImgURL to "URL1" when #Business_Hours__c is not empty or "URL2" otherwise. To display that value, you would then include something like the below:
%%=v(#HoursImgURL)=%%
For example, if using within HTML, it could look like this:
<div><img src="%%=v(#HoursImgURL)=%%" /></div>
Related
Probably a noob Question: On my server, there is a filter which returns all available options if an array of the filter object has length.0 for certain options.
Now if say i have an input "All Options" from the user side, this option when clicked must somehow tell the array to have length.0, so the server returns all options .
I tried to set the Input to
<mat-option [value]= null >Alle</mat-option>
But that results in an array that has the value null instead of no length at all.
I also tried
If (data.array[1] == undefined){
data.array.length == 0
}
But that did not work
Leave the value to null and then do it like this:
if (!data.array) {
data.array = [];
}
I edited an BibteX file and it works so far that it shows all information I need.
FUNCTION {electronic}
{ output.bibitem
format.btitle "title" output.check
url output
format.date "year" output.check
fin.entry
empty.misc.check
}
with
#Electronic{L2PwikiAAS,
title = {Wiki des L2P-Lernraumes},
year = {05.12.2016},
url = {https://~/collaboration/Lists/WikiList1/Atomabsorptionsspektroskopie%20(AAS).aspx},
}
but the URL is very long and it goes over the end of the page.
What should I do to get a linebreak somewhere in this URL?
And how can I add the string 'Zuletzt aufgerufen am:' before the date?
Thanks in advance
You can add characters, after which a line break is allowed: https://norwied.wordpress.com/2012/07/10/how-to-break-long-urls-in-bibtex/
Just add e.g.: \def\UrlBreaks{\do\/\do-} right after \PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
I'm trying to create an XTemplate, and one of my dataIndexes has a period... so my data looks something like this:
{
"one": 1,
"two.one": 21,
"two.two": 22
}
Now, when I'm creating the template, I can't do something like {two.one} because that thinks two is the beginning of an object, and then I'm accessing its key one. I've tried doing something like {'two.one'}, but this also doesn't work, and I've tracked it down to the culprit in Ext.XTemplateCompiler.parseTag. This code is what breaks it:
// compound Javascript property name (e.g., "foo.bar")
else if (isNaN(name) && name.indexOf('-') == -1 && name.indexOf('.') != -1) {
v = "values." + name;
}
// number or a '-' in it or a single word (maybe a keyword): use array notation
// (http://jsperf.com/string-property-access/4)
else {
v = "values['" + name + "']";
}
So with my two.one string, I get into that else if, but what I really want is the else that follows right after it. Unfortunately, it doesn't seem like I can override this in an easy way... does anybody have any thoughts? I'm using Ext JS 4.2.1.
Thanks to skirtle over on the Sencha Forums, I was able to solve it:
Instead of using {two.one} or {'two.one'}, it should be {[values['two.one']]}. Using values directly was the ticket.
I want to set flash message if there's not fullfilled row "surname" in database. How can I check if row surname is null ?
I tried to make something like this:
if(!isset(['User']['surname'])
or
if($user(['User']['surname']) === NULL
it obviously doesnt work
You can check it like.
<?php
if(!isset($user['User']['surname']) || empty($user['User']['surename'])){
// your code goes here
}
if(empty($user['User']['surname'])) {
// your code goes here
}
you can check like this
if(isset($user['surname']) || empty($user['surname'])){
$this->Session->setFlash('No Data.');
}
I wanted to associate a file to a node. so far so good. create a cck type file, and the problem was solved. but I can not do this, I do not want the user to choose the file. the file in question is already in the system.
I have tried to place the file as # default_value field and hide it with the hook_form_FORM_ID_alter, but failed.
function my_module_form_node_form_alter(&$form, $form_state, $form_id) {
if(isset($form['type']) && isset($form['#node'])) {
$type = $form['#node']->type;
if(stripos($type, 'node-type') === FALSE)
return;
switch($type) :
case 'node-type_xyz':
$fid = arg(3);
$file = file_load($fid);
// make a cck field_invoice a hidden field
$form['field_invoice']['#prefix'] = '<div style="display:none;">';
$form['field_invoice']['#suffix'] = '</div>';
$form['field_company']['und'][0]['value']['#default_value'] = 'ABC';
$form['field_account_number']['und'][0]['value']['#default_value'] = '09879';
break;
endswitch;
}
}
anyone have any suggestions?
Don't use #prefix and #suffix to hide it. Instead, set #access to false - that way, people can't fiddle with the form. You can set the value in hook_nodeapi or a submit function, or set the type to 'value' and the #value to your file.