Help

Re: Impossible to combine fields and line break if empty fields

Solved
Jump to Solution
966 0
cancel
Showing results for 
Search instead for 
Did you mean: 
NICK75
5 - Automation Enthusiast
5 - Automation Enthusiast

I am trying to have a formula which give me the possibility to have on the same line two fields separated by a coma. This is tricky, because, i need also to have in the formula that if the field is empty if it not showing the empty space or make a break line.

Right now I have this, 

IF({MARQUES}, " " & {MARQUES} & "\n") &
IF({DESIGNER}, " , " & {DESIGNER} & "\n") &
IF({DATATION}, "  " & {DATATION} & "\n") &
IF({COLLECTION}, " " & {COLLECTION} & "\n") &
IF({FABRICATION}, " " & {FABRICATION} & "\n") &
IF({PRODUIT}, " " & {PRODUIT} & "\n") &
IF({MODELE}, " - " & {MODELE} & "\n") &
IF({MATIERES}, " " & {MATIERES} & "\n") &
IF({COULEURS}, " " & {COULEURS} & "\n") &
IF({DETAIL}, " " & {DETAIL}) &
IF({GRIFFES}, " , " & {GRIFFES} & "\n") &
IF({PROVENANCE}, " " & {PROVENANCE} & "\n") &
IF({TAILLES}, " " & {TAILLES} & "\n") &
IF({CONDITION REPORT}, " " & {CONDITION REPORT} & "\n") &
IF({ICONOGRAPHIES}, " " & {ICONOGRAPHIES}
 
and it is showing this for the moment
MARQUES
X DESIGNER
 
I would like to have MARQUES X DESIGNER
 If i do correction and  write 
IF({MARQUES}, " " & {MARQUES}) &
IF({DESIGNER}, " X " & {DESIGNER} & "\n") &
 
Then I will have 
MARQUES X DESIGNER
 
But If I do so, and if the field MARQUES is EMPTY it create a empty field with a ,
I will have 
, DESIGNER
 
 
 
1 Solution

Accepted Solutions
NICK75
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks that is great

See Solution in Thread

3 Replies 3
Sho
11 - Venus
11 - Venus

To check two fields and branch conditionally, use the AND function.

How to use Like this.

IF(
  AND({MARQUES},{DESIGNER}),
  {MARQUES} & " X " & {DESIGNER} & "\n",
  IF({MARQUES}, " " & {MARQUES} & "\n") &
  IF({DESIGNER}, " " & {DESIGNER} & "\n")
)

 

NICK75
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks that is great

NICK75
5 - Automation Enthusiast
5 - Automation Enthusiast

I still have a problem i would like to use REGEX_REPLACE() to remove all white space next to a line break but I do know how to write it correctly.

here's what I have so far and where should insert and write with REGEX_REPLACE (?????)

 

IF(AND({MARQUES},{DESIGNER}),
{MARQUES} & " X " & {DESIGNER} & "\n",
IF({MARQUES}, " " & {MARQUES} & "\n") &
IF({DESIGNER}, " " & {DESIGNER} & "\n"))&
IF({FABRICATION}, " " & {FABRICATION} & "\n") &
IF(AND({DATATION},{COLLECTION}),
{DATATION} & " - " & {COLLECTION} & "\n",
IF({DATATION}, " " & {DATATION} & "\n") &
IF({COLLECTION}, " " & {COLLECTION} & "\n"))&
IF(AND({PRODUIT},{MODELE}),
{PRODUIT} & " - " & {MODELE} & "\n",
IF({PRODUIT}, " " & {PRODUIT} & "\n") &
IF({MODELE}, " " & {MODELE} & "\n"))&
IF({MATIERES}, " " & {MATIERES} & "\n") &
IF({COULEURS}, " " & {COULEURS} & "\n")&
IF({DETAIL}, " " & {DETAIL} & "\n")&
IF({GRIFFES}, " " & {GRIFFES} & "\n") &
IF({PROVENANCE}, " " & {PROVENANCE} & "\n") &
IF({TAILLES}, " " & {TAILLES} & "\n") &
IF({CONDITION REPORT}, " " & {CONDITION REPORT} & "\n") &
IF({ICONOGRAPHIES}, " " & {ICONOGRAPHIES} & "\n") &
IF({CITES}, " " & {CITES})