• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFC return types

New Here ,
Apr 10, 2007 Apr 10, 2007

Copy link to clipboard

Copied

Is there anyway to have a returntype set and return different data types based on conditions. i.e. Do a query but if the query has no records return false, or a message (string). Meaning you are potentially returning either a query if there's a match or a string, boolean etc if there's not.

Do you just have to leave the returntype off if you want to do this kind of thing?.

Thx in advance.
TOPICS
Advanced techniques

Views

533

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Apr 11, 2007 Apr 11, 2007
thx for that guys. that's what i figured thought i would dbl check though. I'll most likely return a structure and work with it that way.

Votes

Translate

Translate
LEGEND ,
Apr 11, 2007 Apr 11, 2007

Copy link to clipboard

Copied

You could try returntype = any, but then you have to figure it out on the calling page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 11, 2007 Apr 11, 2007

Copy link to clipboard

Copied

You could also return a structure and use one of the keys as a function status code and/or error message.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2007 Apr 11, 2007

Copy link to clipboard

Copied

LATEST
thx for that guys. that's what i figured thought i would dbl check though. I'll most likely return a structure and work with it that way.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation