如果没有日期,我希望我的代码不显示任何内容。
这是我的代码:
#include <stdio.h>
#include <stdlib.h>
struct node{
int num;
struct node *next;
};
//Make the struct
typedef struct {
struct node * first;
struct node * current;
}linkedList;
void addNode(linkedList* list, int a);
void addFirstNode(linkedList* list, int b);
//Function prototypes
int main() {
linkedList *list = (struct node *)malloc(sizeof(struct node));;
addFirstNode(list, 1);
addNode(list, 2);
addNode(list, 3);
addNode(list, 4);
addNode(list, 5);
addNode(list, 6);
addNode(list, 7);
}
void addFirstNode(linkedList* list, int input) {
list->first = (struct node *)malloc(sizeof(struct node)); //Make first node
list->first->num = input; //Fill first node
list->current = list->first;
}
void addNode(linkedList *list, int input) {
struct node * newNode = (struct node *)malloc(sizeof(struct node));
newNode->num = input;
list->current->next = newNode; //Segmentation fault! (core dumped)
list->current = newNode;
}
因为我将其格式化为=format(IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection", Fields!PreFeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition", Fields!FeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Implementation", Fields!ImplementationCurrentTargetDate.Value, ""))), "dd-MMM-yy")
,所以当项目没有日期时会显示。如果它没有日期,我怎么能改变它以显示任何内容。
答案 0 :(得分:1)
将表达式的空白值更改为空
=Iif(Fields!Phase.Value="Operation","-", format(
IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection",
Fields!PreFeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition",
Fields!FeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Implementation",
Fields!ImplementationCurrentTargetDate.Value, Nothing)))
, "dd-MMM-yy") )
我还建议您使用字段格式属性而不是值表达式中的格式函数。在这种情况下,即使字段值为空白也可以使用
答案 1 :(得分:0)
在这里查看MSDN表单, https://msdn.microsoft.com/en-us/library/ms157406.aspx
它清楚地提到“如果指定了无效的格式字符串,则格式化的文本将被解释为覆盖格式的文字字符串。”
因此。您需要在格式化后检查字符串,
IIF(output="dd-MMM-yy","",output)